/* src/web/public/styles.css
 *
 * One stylesheet for the whole dashboard. Every class the templates use lives
 * here; nothing is scoped per-page, because the pages are all the same handful
 * of shapes — a header, some grouped fields, a save bar.
 */

:root {
  /* Surfaces run darkest -> lightest so depth is always a step up, never a
     border. Borders are then only needed where two surfaces are the same. */
  --bg: #0e0f13;
  --surface: #16181d;
  --surface-2: #1e2026;
  --surface-3: #272a31;
  --border: #2a2d35;
  --border-soft: #21242b;

  --text: #eceef2;
  --text-dim: #b6bac2;
  --muted: #8b909b;

  --accent: #6571f5;
  --accent-hover: #7b85ff;
  --accent-soft: rgb(101 113 245 / .14);
  --accent-line: rgb(101 113 245 / .45);

  --ok: #4ade80;
  --ok-soft: rgb(74 222 128 / .12);
  --warn: #fbbf24;
  --err: #f4525a;
  --err-soft: rgb(244 82 90 / .12);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / .3);
  --shadow: 0 4px 16px rgb(0 0 0 / .28);
  --shadow-lg: 0 12px 36px rgb(0 0 0 / .4);

  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-line);
}

* { box-sizing: border-box; }

body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  /* Inter carries no Arabic, so the Arabic faces sit behind it in the same
     stack: Latin still renders in Inter, Arabic falls through to whichever of
     these the reader's OS has. Named explicitly rather than left to the
     generic sans-serif, which on Windows lands on Tahoma and looks dated. */
  font: 15px/1.6 "Inter", "Segoe UI", system-ui, -apple-system,
        "Noto Sans Arabic", "Noto Naskh Arabic", "Dubai", "Geeza Pro",
        "Segoe UI Arabic", "Tahoma", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }

h1 { font-size: 1.6rem; margin: 0 0 .3rem; letter-spacing: -.02em; font-weight: 650; }
h2, h3 { letter-spacing: -.01em; }
h2.section { font-size: .95rem; text-transform: uppercase; letter-spacing: .06em;
             color: var(--muted); margin: 2.5rem 0 .75rem; }
p { margin: .4rem 0; }
code { background: var(--surface-2); padding: .12em .4em; border-radius: 5px;
       font-size: .88em; font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; }

.muted { color: var(--muted); }
.fine { font-size: .82rem; line-height: 1.55; }
.nowrap { white-space: nowrap; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* --- layout --- */

.wrap { width: 100%; max-width: 900px; margin: 0 auto; padding: 2rem 1.25rem 4rem; flex: 1; }
.center { flex: 1; display: grid; place-items: center; padding: 2rem 1.25rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem 1.5rem; background: rgb(22 24 29 / .85);
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 650;
         letter-spacing: -.01em; }
.brand-dot { width: 11px; height: 11px; border-radius: 50%;
             background: linear-gradient(140deg, var(--accent-hover), var(--accent));
             box-shadow: 0 0 0 4px var(--accent-soft); }
.brand-dot-lg { width: 24px; height: 24px; display: block; margin: 0 auto 1.1rem; }

.user { display: flex; align-items: center; gap: .7rem; }
.user-name { font-size: .9rem; color: var(--text-dim); }
.avatar { border-radius: 50%; display: block; border: 1px solid var(--border); }

.footer { padding: 1.75rem 1.25rem; text-align: center;
          border-top: 1px solid var(--border-soft); color: var(--muted);
          display: flex; justify-content: center; gap: 1.25rem; flex-wrap: wrap;
          font-size: .85rem; }
.footer-links { display: flex; gap: 1.1rem; }

/* legal pages */
.prose { max-width: 700px; }
.prose h2 { font-size: 1.1rem; margin: 2.2rem 0 .5rem; }
.prose p, .prose ul { color: var(--text-dim); }
.prose ul { margin: .6rem 0; padding-inline-start: 1.2rem; }
.prose li { margin: .35rem 0; }

/* --- dashboard shell --- */

.shell {
  flex: 1; display: grid; grid-template-columns: 236px minmax(0, 1fr);
  gap: 2.25rem; width: 100%; max-width: 1200px; margin: 0 auto;
  padding: 1.9rem 1.5rem 5rem;
}
.content { min-width: 0; }
.content-head { margin-bottom: 1.5rem; }
.content-head .muted { margin: 0; }

.sidebar { display: flex; flex-direction: column; gap: .3rem; align-self: start;
           position: sticky; top: 5rem; }
.side-guild {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem;
  border-radius: var(--radius-sm); margin-bottom: .7rem;
  border: 1px solid transparent; transition: background .14s, border-color .14s;
}
.side-guild:hover { background: var(--surface); border-color: var(--border-soft); }
.side-guild-name { font-weight: 600; font-size: .92rem; overflow: hidden;
                   text-overflow: ellipsis; white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: .1rem; }
.side-link {
  position: relative; padding: .52rem .75rem; border-radius: var(--radius-sm);
  color: var(--muted); font-size: .91rem; transition: background .14s, color .14s;
}
.side-link:hover { background: var(--surface); color: var(--text); }
.side-link.is-active { background: var(--accent-soft); color: var(--text); font-weight: 550; }
.side-link.is-active::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.side-link-quiet { margin-top: 1.2rem; font-size: .85rem; }

/* --- card --- */

.card { background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow); }
.card-narrow { width: 100%; max-width: 400px; text-align: center; }
.card-narrow h1 { margin-bottom: .5rem; }
.code { font-size: 2.75rem; font-weight: 700; color: var(--muted); display: block;
        letter-spacing: -.03em; }

/* --- buttons --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .58rem 1.05rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; font: inherit; font-size: .92rem; font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-block { display: flex; width: 100%; margin-top: 1rem; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger:hover { background: var(--err-soft); color: #ff9ba0; border-color: rgb(244 82 90 / .35); }

/* --- alerts --- */

.alert { border-radius: var(--radius-sm); padding: .8rem 1rem; margin: 1rem 0;
         font-size: .9rem; border: 1px solid; line-height: 1.55; }
.alert-error { background: var(--err-soft); border-color: rgb(244 82 90 / .3); color: #ffb3b7; }
.alert-info  { background: var(--accent-soft); border-color: var(--accent-line); color: #ccd1ff; }
.alert-ok    { background: var(--ok-soft); border-color: rgb(74 222 128 / .3); color: #b2f2c8; }

/* --- grids / tiles --- */

.grid { display: grid; gap: .8rem; margin-top: 1.1rem;
        grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); }

.guild, .panel {
  display: flex; align-items: center; gap: .9rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .95rem 1.05rem;
  transition: border-color .14s, transform .14s, box-shadow .14s;
}
.guild:hover, .panel:hover { border-color: var(--accent-line);
                             transform: translateY(-2px); box-shadow: var(--shadow); }
.guild-muted { opacity: .55; }
.guild-muted:hover { opacity: 1; border-color: var(--border); transform: none; box-shadow: none; }
.guild-name { flex: 1; font-weight: 550; overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; }

.guild-icon { border-radius: 30%; flex-shrink: 0; display: block; }
.guild-icon-fallback { width: 48px; height: 48px; display: grid; place-items: center;
                       background: var(--surface-2); font-size: .85rem;
                       font-weight: 650; color: var(--muted); }
.guild-icon-lg { width: 64px; height: 64px; }
.guild-icon-lg.guild-icon-fallback { font-size: 1.3rem; }
.guild-header { display: flex; align-items: center; gap: 1.15rem; margin: 0 0 1.4rem; }

.panel { flex-direction: column; align-items: flex-start; gap: .25rem; }
.panel-name { font-weight: 600; }

.stat-row { display: grid; gap: .8rem; margin-bottom: 1.6rem;
            grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius); padding: .9rem 1.05rem;
        display: flex; flex-direction: column; gap: .05rem; }
.stat-n { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; }

.chip { display: inline-block; font-size: .7rem; text-transform: uppercase;
        letter-spacing: .06em; font-weight: 650;
        padding: .22rem .55rem; border-radius: 999px;
        background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.chip-ok      { background: var(--ok-soft); color: var(--ok); }
.chip-ban, .chip-kick        { background: var(--err-soft); color: #ff9ba0; }
.chip-timeout, .chip-warn    { background: rgb(251 191 36 / .12); color: var(--warn); }
.chip-unban, .chip-untimeout { background: var(--ok-soft); color: var(--ok); }

.back { display: inline-block; color: var(--muted); font-size: .88rem; }

/* --- forms --- */

.group { background: var(--surface); border: 1px solid var(--border);
         border-radius: var(--radius); padding: 1.35rem 1.45rem; margin-bottom: 1rem; }
.group-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .09em;
               color: var(--muted); margin: 0 0 1.15rem; font-weight: 650; }

.field { margin-bottom: 1.15rem; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: .88rem; font-weight: 550; margin-bottom: .4rem; }
.hint { display: block; margin-top: .35rem; }

.input {
  width: 100%; padding: .58rem .75rem; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  font: inherit; font-size: .92rem; transition: border-color .14s, background .14s;
}
.input:hover { border-color: var(--surface-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 2.6rem; line-height: 1.55; }
select.input { cursor: pointer; }

.field-row { display: grid; gap: .8rem;
             grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.color-row { display: flex; align-items: center; gap: .7rem; }
.color-row input[type="color"] { width: 44px; height: 32px; padding: 0; cursor: pointer;
                                 background: none; border: 1px solid var(--border);
                                 border-radius: 6px; }

/* toggle switch */
.switch-row { display: flex; align-items: flex-start; gap: .8rem; cursor: pointer;
              padding: .5rem 0; margin-bottom: .5rem; }
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch { flex-shrink: 0; width: 38px; height: 22px; border-radius: 999px;
          background: var(--surface-3); position: relative; margin-top: .1rem;
          transition: background .16s; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
                 width: 16px; height: 16px; border-radius: 50%; background: #fff;
                 transition: transform .16s; box-shadow: var(--shadow-sm); }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
/* translateX has no logical form, so the knob would slide the wrong way. */
[dir="rtl"] .switch-row input:checked + .switch::after { transform: translateX(-16px); }
.switch-row input:focus-visible + .switch { box-shadow: var(--ring); }
.switch-text { display: flex; flex-direction: column; gap: .1rem; font-size: .92rem; }

.checkbox-box { max-height: 15rem; overflow-y: auto; padding: .65rem .8rem;
                background: var(--bg); border: 1px solid var(--border);
                border-radius: var(--radius-sm); display: flex;
                flex-direction: column; gap: .3rem; }
.checkbox { display: flex; align-items: center; gap: .55rem; font-size: .9rem;
            cursor: pointer; padding: .12rem 0; }
.checkbox input { accent-color: var(--accent); }

.routes { display: flex; flex-direction: column; gap: .5rem; }
.route-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
             gap: .8rem; align-items: start; padding: .5rem .65rem;
             background: var(--bg); border: 1px solid var(--border-soft);
             border-radius: var(--radius-sm); }
.route-name { font-size: .9rem; }
.route-select { font-size: .85rem; }

.save-bar { display: flex; gap: .6rem; align-items: center;
            position: sticky; bottom: 0; padding: .9rem 0 1.1rem;
            background: linear-gradient(to top, var(--bg) 62%, transparent); }

/* --- premium locks --- */

.upsell { display: flex; align-items: center; justify-content: space-between;
          gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1rem;
          padding: .95rem 1.15rem; border-radius: var(--radius);
          border: 1px solid var(--accent-line);
          background: linear-gradient(120deg, var(--accent-soft), transparent 65%), var(--surface);
          font-size: .92rem; }

/* A locked field is still rendered and still shows its saved value — hiding it
   would leave people guessing what they'd get, and blanking it would imply the
   setting was lost. It is simply not operable. */
.locked { position: relative; border: 1px dashed var(--border);
          border-radius: var(--radius); padding: .85rem 1rem .35rem;
          margin-bottom: 1.15rem; background: var(--bg); }
.locked-bar { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.lock-pill { font-size: .66rem; font-weight: 700; letter-spacing: .08em;
             text-transform: uppercase; padding: .2rem .5rem; border-radius: 999px;
             background: var(--accent); color: #fff; }
.locked-link { font-size: .82rem; color: var(--accent-hover); font-weight: 550; }
.locked-link:hover { text-decoration: underline; }
.locked-body { border: 0; margin: 0; padding: 0; min-width: 0; opacity: .5; }
.locked-body .input { cursor: not-allowed; }

.cap-note { margin: -.7rem 0 1.15rem; }
.cap-note a { color: var(--accent-hover); }
.cap-note a:hover { text-decoration: underline; }

/* --- plan & billing --- */

.plan-head { display: flex; justify-content: space-between; align-items: flex-start;
             gap: 1.5rem; flex-wrap: wrap; }
.plan-title { font-size: 1.4rem; margin: .55rem 0 .3rem; }
.plan-cta { text-align: end; max-width: 280px; }
.plan-cta .muted { margin-top: .5rem; display: block; }

.upgrade-cta { display: flex; align-items: center; justify-content: space-between;
               gap: 1.5rem; flex-wrap: wrap;
               border-color: var(--accent-line);
               background: linear-gradient(120deg, var(--accent-soft), transparent 60%), var(--surface); }
.upgrade-cta-title { margin: 0 0 .2rem; font-size: 1.1rem; }
.upgrade-cta p { margin: 0; }

.usage { display: flex; flex-direction: column; gap: 1rem; }
.usage-row { display: flex; flex-direction: column; gap: .4rem; }
.usage-label { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.usage-label .over { color: #ff9ba0; }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 999px;
              background: linear-gradient(90deg, var(--accent), var(--accent-hover));
              transition: width .25s; }
.meter-over { background: var(--err); }

/* --- pricing --- */

.pricing { padding: 1.75rem 1.5rem 1.6rem; }
.pricing-head { text-align: center; max-width: 46rem; margin: 0 auto 1.75rem; }
.pricing-title { font-size: 1.65rem; margin: 0 0 .45rem; letter-spacing: -.02em; }
.pricing-head .muted { margin: 0 0 1.35rem; }

.cycle { display: inline-flex; gap: .25rem; padding: .28rem;
         background: var(--bg); border: 1px solid var(--border); border-radius: 999px; }
.cycle-btn { border: 0; background: transparent; color: var(--muted);
             font: inherit; font-size: .88rem; font-weight: 550;
             padding: .45rem 1.15rem; border-radius: 999px; cursor: pointer;
             display: inline-flex; align-items: center; gap: .5rem;
             transition: background .15s, color .15s; }
.cycle-btn:hover { color: var(--text); }
.cycle-btn.is-on { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }
.cycle-save { font-size: .7rem; font-weight: 700; letter-spacing: .04em;
              text-transform: uppercase; color: var(--ok); }

/* Cards are <button>s, so keyboard focus and selection come for free. */
.plans { display: grid; gap: .9rem; margin-bottom: 1.6rem;
         grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.plan-card { position: relative; text-align: start; cursor: pointer; font: inherit;
             color: var(--text); background: var(--bg);
             border: 1px solid var(--border); border-radius: var(--radius);
             padding: 1.25rem 1.15rem 1.3rem;
             transition: border-color .15s, transform .15s, box-shadow .15s; }
.plan-card:hover { border-color: var(--accent-line); transform: translateY(-3px); }
.plan-card.is-on { border-color: var(--accent);
                   box-shadow: 0 0 0 1px var(--accent), var(--shadow-lg); }
.plan-card.is-featured { background:
  linear-gradient(180deg, var(--accent-soft), transparent 55%), var(--bg); }

.plan-badge { position: absolute; top: -.62rem; inset-inline-end: .9rem;
              background: var(--accent); color: #fff; font-size: .64rem;
              font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
              padding: .24rem .55rem; border-radius: 999px; box-shadow: var(--shadow-sm); }

.plan-name { font-size: 1.02rem; margin: 0 0 .2rem; }
.plan-servers { margin: 0 0 .9rem; font-size: .78rem; font-weight: 650;
                letter-spacing: .05em; text-transform: uppercase; color: var(--accent-hover); }
.plan-price { margin: 0; display: flex; align-items: baseline; gap: .3rem; }
.plan-amount { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; }
.plan-per { font-size: .85rem; color: var(--muted); }
.plan-sub { margin: .25rem 0 0; min-height: 1.15em; }
.plan-blurb { margin: .75rem 0 0; }

.perks { list-style: none; margin: 0; padding: 1.25rem 0 0;
         border-top: 1px solid var(--border-soft);
         display: grid; gap: .55rem 1rem; font-size: .88rem;
         grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); }
.perks li { position: relative; padding-inline-start: 1.5rem; color: var(--text-dim); }
.perks li::before { content: ""; position: absolute; inset-inline-start: .15rem; top: .45em;
                    width: .6rem; height: .32rem; border-left: 2px solid var(--ok);
                    border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }

/* --- checkout --- */

.checkout-panel { border-color: var(--accent-line); }
.checkout-summary { display: flex; align-items: center; justify-content: space-between;
                    gap: 1.25rem; flex-wrap: wrap; padding-bottom: 1.15rem;
                    margin-bottom: 1.35rem; border-bottom: 1px solid var(--border-soft); }
.checkout-summary p { margin: 0; }
.checkout-plan { font-size: 1.08rem; font-weight: 600; }
.checkout-total { text-align: end; display: flex; flex-direction: column; }
.checkout-total span:first-child { font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; }

.pay { display: flex; justify-content: center; }
.pay-inner { width: 100%; max-width: 22rem; }
.pay-inner .muted { display: block; margin-top: .85rem; text-align: center; }

/* --- owned subscriptions --- */

.sub-card { border: 1px solid var(--border); border-radius: var(--radius);
            background: var(--bg); padding: 1.15rem 1.2rem; margin-bottom: .8rem; }
.sub-card.is-lapsed { opacity: .72; }
.sub-card-head { display: flex; justify-content: space-between; align-items: flex-start;
                 gap: 1rem; flex-wrap: wrap; }
.sub-name { margin: 0 0 .3rem; font-size: 1.02rem;
            display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.sub-actions { display: flex; gap: .45rem; flex-wrap: wrap; }

.slot-dots { display: flex; flex-wrap: wrap; gap: .32rem; margin: 1rem 0 0; }
.slot-dot { width: .55rem; height: .55rem; border-radius: 50%;
            background: var(--surface-3); }
.slot-dot.is-used { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.slot-list { list-style: none; margin: 1rem 0 0; padding: .95rem 0 0;
             border-top: 1px solid var(--border-soft);
             display: flex; flex-direction: column; gap: .55rem; }
.slot-list li { display: flex; justify-content: space-between; align-items: center;
                gap: 1rem; font-size: .9rem; }
.slot-list .btn { padding: .32rem .65rem; font-size: .8rem; }

/* --- tables --- */

.table-scroll { overflow-x: auto; margin: 0 -.3rem; padding: 0 .3rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; font-size: .72rem; text-transform: uppercase;
            letter-spacing: .07em; color: var(--muted); font-weight: 650;
            padding: 0 .9rem .7rem 0; border-bottom: 1px solid var(--border); }
.table td { padding: .68rem .9rem .68rem 0; border-bottom: 1px solid var(--border-soft);
            vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.compare .is-yours { color: var(--text); font-weight: 600; }
.compare th:last-child, .compare td:last-child { padding-inline-end: 0; }

/* --- auto-responses --- */

.rules { display: flex; flex-direction: column; gap: .65rem; }
.rule { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
        background: var(--bg); border: 1px solid var(--border);
        border-radius: var(--radius); padding: .9rem 1rem; }
.rule-off { opacity: .55; }
.rule-main { min-width: 0; }
.rule-head { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
             margin-bottom: .25rem; }
.rule-trigger { font-weight: 600; overflow-wrap: anywhere; }
.rule-response { color: var(--text-dim); font-size: .89rem; overflow-wrap: anywhere; }
.rule-actions { display: flex; gap: .4rem; flex-shrink: 0; }
.rule-actions .btn { padding: .36rem .7rem; font-size: .84rem; }

/* --- moderation --- */

.strike-row { display: flex; justify-content: space-between; gap: 1rem;
              font-size: .9rem; padding: .42rem 0;
              border-bottom: 1px solid var(--border-soft); }
.strike-row:last-child { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; }
.reason { color: var(--text-dim); }
.pager { display: flex; gap: .6rem; align-items: center; justify-content: center;
         margin-top: 1.35rem; font-size: .9rem; }

/* --- bot profile preview --- */

.profile-preview { border: 1px solid var(--border); border-radius: var(--radius);
                   overflow: hidden; margin-bottom: 1.35rem; background: var(--bg); }
.profile-banner { height: 120px; background: var(--surface-2) center/cover no-repeat;
                  display: grid; place-items: center; }
.profile-id { display: flex; align-items: center; gap: .9rem; padding: .95rem 1.1rem; }
.nick-form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }

/* --- language picker --- */

.topbar-right { display: flex; align-items: center; gap: .9rem; }

.langpicker { display: flex; align-items: center; gap: .4rem; margin: 0; }
.lang-select {
  appearance: none; font: inherit; font-size: .85rem;
  padding: .34rem 1.9rem .34rem .7rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim);
  cursor: pointer;
  /* The chevron is a background image so it can sit on the correct side in
     both directions; `right` here is physical on purpose and overridden
     for RTL below, because background-position has no logical form. */
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-size: 5px 5px, 5px 5px;
  background-position: right 1rem top 52%, right .74rem top 52%;
  background-repeat: no-repeat;
}
.lang-select:hover { background-color: var(--surface-3); color: var(--text); }
.lang-select:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent-line); }

[dir="rtl"] .lang-select {
  padding: .34rem .7rem .34rem 1.9rem;
  background-position: left 0.74rem top 52%, left 1rem top 52%;
}

/* Visible to screen readers, not on screen. The picker's label needs to exist
   for the select to be announced, but printing "Language" next to a control
   that already shows the language name is noise. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- role menus --- */

.rr-form { display: flex; flex-direction: column; gap: .9rem; }
.rr-sub { font-size: .95rem; font-weight: 600; margin: .4rem 0 0; }
.rr-options { display: flex; flex-direction: column; gap: .5rem; }
/* Role, label, emoji, description on one line — the emoji box only ever holds
   a couple of characters, so it does not get an equal share. */
.rr-option { display: grid; gap: .5rem;
             grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 5.5rem minmax(0, 1.2fr); }
.rr-option .input { min-width: 0; }
.rr-emoji { text-align: center; }
.rr-problem { color: #ff9ba0; margin: -.15rem 0 .2rem; }

/* --- log archive --- */

.filters { background: var(--surface); border: 1px solid var(--border);
           border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1.3rem; }
.filter-row { display: grid; gap: .8rem; align-items: end;
              grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
/* The text box is the one people use most, so it gets the extra width. */
.filter-grow { grid-column: span 2; }
.filter-row .field { margin: 0; }
.filter-actions { display: flex; align-items: center; gap: .7rem;
                  margin-top: .9rem; flex-wrap: wrap; }

.logs-table td { vertical-align: top; }
.log-summary { font-size: .92rem; }
.log-who { margin-top: .2rem; }
.log-detail { margin-top: .35rem; }
.log-detail > summary { cursor: pointer; user-select: none; list-style: none; }
.log-detail > summary::-webkit-details-marker { display: none; }
.log-detail > summary::before { content: "▸ "; }
.log-detail[open] > summary::before { content: "▾ "; }
/* Logged content is arbitrary text — a pasted wall with no spaces would
   otherwise stretch the table until the page scrolls sideways. */
.log-pre {
  margin: .4rem 0 0; padding: .6rem .7rem; max-height: 260px; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); font-size: .8rem; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* --- statistics --- */

.range { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.range-btn { font-size: .85rem; font-weight: 550; padding: .4rem .85rem;
             border-radius: 999px; border: 1px solid var(--border);
             background: var(--surface); color: var(--text-dim);
             text-decoration: none; transition: background .12s, color .12s, border-color .12s; }
.range-btn:hover { background: var(--surface-2); color: var(--text); }
.range-btn.is-on { background: var(--accent-soft); border-color: var(--accent-line);
                   color: var(--text); }

/* The chart is bars in a flex row, not a canvas: it has to render before any
   script runs and read correctly to a screen reader, and 90 divs is cheaper
   than a charting library. */
.chart { display: flex; align-items: flex-end; gap: 2px; height: 190px;
         padding: .5rem .25rem 0; }
/* Oldest day on the left in both directions. Arabic mirrors text, not a time
   axis — a chart that ran right-to-left would put "today" where the reader
   expects the start of the period. */
[dir="rtl"] .chart { flex-direction: row-reverse; }
.chart-col { flex: 1 1 0; min-width: 0; height: 100%;
             display: flex; flex-direction: column; justify-content: flex-end;
             align-items: center; gap: .35rem; }
.chart-bar { display: block; width: 100%; max-width: 34px;
             border-radius: 3px 3px 0 0;
             background: linear-gradient(180deg, var(--accent-hover), var(--accent));
             transition: filter .12s; }
.chart-col:hover .chart-bar { filter: brightness(1.25); }
.chart-label { font-size: .66rem; color: var(--muted); white-space: nowrap;
               height: 1em; line-height: 1; }

.split { display: grid; gap: 1.1rem; grid-template-columns: 1fr 1fr;
         align-items: start; }

.rank-list { list-style: none; margin: 0 0 .7rem; padding: 0;
             display: flex; flex-direction: column; gap: .1rem; }
.rank-list li { display: flex; align-items: center; gap: .7rem;
                padding: .5rem .15rem; border-bottom: 1px solid var(--border-soft);
                font-size: .9rem; }
.rank-list li:last-child { border-bottom: 0; }
.rank-n { flex: none; width: 1.55rem; height: 1.55rem; border-radius: 50%;
          display: grid; place-items: center; font-size: .75rem; font-weight: 650;
          background: var(--surface-3); color: var(--muted); }
.rank-list li:first-child .rank-n { background: var(--accent-soft); color: var(--accent-hover); }
/* Names come from Discord and can be long enough to push the count off the
   row, so the name is the part that gives way. */
.rank-name { flex: 1 1 auto; min-width: 0; overflow: hidden;
             text-overflow: ellipsis; white-space: nowrap; }

/* --- responsive --- */

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.25rem 1rem 4rem; }
  .sidebar { position: static; }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: .35rem; }
  .side-link { border-radius: 999px; background: var(--surface); }
  .side-link.is-active::before { display: none; }
}

@media (max-width: 720px) {
  .plans { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .filter-grow { grid-column: auto; }
  .rr-option { grid-template-columns: 1fr; }
  .chart { height: 140px; }
  .pay-inner { max-width: none; }
  .plan-cta { text-align: start; max-width: none; }
  .route-row { grid-template-columns: 1fr; }
  .checkout-total { text-align: start; }
  .topbar { padding: .75rem 1rem; }
}
