/* Activity Check dashboard
   Paper and ink, with the three rating colours doing the talking. */

:root {
  color-scheme: light dark;

  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --surface-3: #e8e5dd;
  --line: #e1ded6;
  --line-soft: #ecEAe4;
  --grid: #dcd8ce;

  --ink: #191814;
  --ink-2: #4b4840;
  --ink-3: #86827a;

  --accent: #2d4fd6;
  --accent-ink: #ffffff;
  --accent-tint: #e9edfc;

  --bad: #c43444;   --bad-tint: #fbe8ea;
  --ok: #9b6a00;    --ok-tint: #fbf0d4;
  --good: #267a36;  --good-tint: #e2f1e4;

  --dot-bad: #e5484d;
  --dot-ok: #f5b83d;
  --dot-good: #46a758;

  --mark-bg: #191814;
  --shadow: 0 1px 2px rgba(25,24,20,.04), 0 10px 28px -16px rgba(25,24,20,.18);
  --shadow-lg: 0 2px 4px rgba(25,24,20,.05), 0 24px 60px -24px rgba(25,24,20,.3);

  --r: 12px;
  --r-sm: 7px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --sidebar-w: 248px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f0d;
    --surface: #161714;
    --surface-2: #1c1d1a;
    --surface-3: #262723;
    --line: #2a2c27;
    --line-soft: #21231f;
    --grid: #262823;
    --ink: #efeee8;
    --ink-2: #b7b5ab;
    --ink-3: #807e75;
    --accent: #8ca6ff;
    --accent-ink: #0c1024;
    --accent-tint: #1a2137;
    --bad: #f2838e;   --bad-tint: #2b181b;
    --ok: #f0c35c;    --ok-tint: #292214;
    --good: #7dcb89;  --good-tint: #15261a;
    --mark-bg: #262723;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 12px 32px -18px rgba(0,0,0,.7);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.4), 0 30px 70px -30px rgba(0,0,0,.9);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 1.5rem; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -.015em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .6rem; }
.muted { color: var(--ink-3); }
.text-bad { color: var(--bad); }
code {
  font-family: var(--mono);
  font-size: .82em;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  padding: .05em .35em;
  border-radius: 4px;
}
.ico, .mark { display: block; flex-shrink: 0; }

.eyebrow {
  margin: 0 0 .35rem;
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .55rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-weight: 500; font-size: .9rem;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
  cursor: pointer;
  transition: background-color .12s, border-color .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; background: var(--surface-2); border-color: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.3rem; font-size: .98rem; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.08); }

/* ---------- top bar pages (login, servers, legal) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 1120px; margin: 0 auto;
  padding: 1.1rem 1.5rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 600; font-size: 1rem; }
.brand:hover { text-decoration: none; }
.user { display: flex; align-items: center; gap: .6rem; font-size: .88rem; color: var(--ink-2); }
.user img { width: 28px; height: 28px; border-radius: 50%; }
.container { max-width: 1120px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }

.login {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 4rem; align-items: center;
  min-height: calc(100vh - 220px);
}
.login h1 { font-size: clamp(2rem, 3.4vw, 2.75rem); line-height: 1.1; letter-spacing: -.025em; margin-bottom: 1rem; max-width: 16ch; }
.login .lead { font-size: 1.05rem; color: var(--ink-2); max-width: 46ch; margin-bottom: 1.8rem; }
.login-points { list-style: none; padding: 0; margin: 2.2rem 0 0; display: grid; gap: .55rem; color: var(--ink-2); font-size: .92rem; }
.login-points li { display: flex; align-items: center; gap: .6rem; }
.login-preview { position: relative; }
.login-preview::before {
  content: ""; position: absolute; inset: -2.5rem -2rem;
  background-image: radial-gradient(var(--grid) 1px, transparent 1.2px);
  background-size: 16px 16px;
  -webkit-mask-image: radial-gradient(closest-side, #000 40%, transparent);
          mask-image: radial-gradient(closest-side, #000 40%, transparent);
  z-index: -1;
}
.login-preview .discord { box-shadow: var(--shadow-lg); transform: rotate(-1.2deg); }

.error-page { max-width: 420px; margin: 4rem auto; }

/* servers */
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; }
.server-card {
  display: flex; align-items: center; gap: .9rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  color: var(--ink);
  transition: border-color .12s, transform .12s;
}
.server-card:hover { text-decoration: none; border-color: var(--ink-3); transform: translateY(-1px); }
.server-card img, .server-card .avatar { width: 46px; height: 46px; border-radius: 12px; font-size: 1.15rem; }
.server-txt { flex: 1; min-width: 0; }
.server-txt b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-txt small { color: var(--ink-3); font-size: .82rem; }
.server-go { color: var(--ink-3); }
.section-title { margin: 2.6rem 0 .3rem; }
.dim { opacity: .8; }
.empty-card { max-width: 560px; }
.empty-card h2 { margin-bottom: .4rem; }

.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  background: var(--surface-3);
  color: var(--ink-2);
  font-weight: 600;
}
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; font-size: .8rem; }

/* ---------- app shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: sticky; top: 0; align-self: flex-start; height: 100vh;
  display: flex; flex-direction: column;
  padding: 1.1rem .85rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.s-brand {
  display: flex; align-items: center; gap: .55rem;
  padding: .15rem .45rem 1.1rem;
  color: var(--ink); font-weight: 600; font-size: .95rem;
}
.s-brand:hover { text-decoration: none; }
.s-server {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .6rem;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  color: var(--ink);
}
.s-server:hover { text-decoration: none; border-color: var(--line); }
.s-server img, .s-server .avatar { width: 34px; height: 34px; border-radius: 9px; }
.s-server-txt { flex: 1; min-width: 0; }
.s-server b { display: block; font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-server small { color: var(--ink-3); font-size: .76rem; }
.s-switch { color: var(--ink-3); }

.s-nav { display: flex; flex-direction: column; gap: 2px; margin-top: .6rem; }
.s-label {
  padding: 1rem .6rem .35rem;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3);
}
.s-nav a {
  position: relative;
  display: flex; align-items: center; gap: .65rem;
  padding: .52rem .6rem;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: .91rem; font-weight: 500;
}
.s-nav a .ico { color: var(--ink-3); }
.s-nav a:hover { text-decoration: none; background: var(--surface-2); color: var(--ink); }
.s-nav a.active { background: var(--surface-2); color: var(--ink); }
.s-nav a.active::before {
  content: ""; position: absolute; left: -.85rem; top: .45rem; bottom: .45rem;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.s-nav a.active .ico { color: var(--accent); }

.s-foot {
  margin-top: auto;
  display: flex; align-items: center; gap: .5rem;
  padding: .85rem .3rem 0;
  border-top: 1px solid var(--line-soft);
  font-size: .84rem; color: var(--ink-2);
}
.s-foot img { width: 28px; height: 28px; border-radius: 50%; }
.s-foot .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 300px;
  background-image: radial-gradient(var(--grid) 1px, transparent 1.2px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent);
          mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent);
  pointer-events: none;
}
.content .inner { position: relative; flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 2.4rem 2rem 2.5rem; }
.content > .foot { position: relative; }

.phead {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
.phead .sub { margin: .4rem 0 0; color: var(--ink-3); }
.back { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--ink-3); margin-bottom: 1rem; }
.back:hover { color: var(--ink); text-decoration: none; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.1rem;
}
.card.flush { padding: 0; overflow: hidden; }
.card > h2 { margin-bottom: .25rem; }
.card-title { margin-bottom: 1.3rem; }
.card-sub { margin: .25rem 0 0; color: var(--ink-3); font-size: .88rem; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--line);
}
.card-foot { padding: .8rem 1.3rem; border-top: 1px solid var(--line-soft); font-size: .82rem; background: var(--surface-2); }

.seg-control {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  font-size: .83rem;
}
.seg-control a { padding: .28rem .7rem; border-radius: 5px; color: var(--ink-3); }
.seg-control a:hover { text-decoration: none; color: var(--ink); }
.seg-control a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.hint {
  display: flex; align-items: center; gap: .7rem;
  padding: .8rem 1rem;
  margin-bottom: 1.1rem;
  background: var(--accent-tint);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--r-sm);
  font-size: .9rem; color: var(--ink);
}
.hint .ico { color: var(--accent); }

/* stats */
.stats { display: grid; grid-template-columns: .8fr .8fr 1.2fr 1.2fr; gap: .8rem; margin-bottom: 1.1rem; }
.stat {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1.05rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  min-width: 0;
}
.stat-label { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--ink-3); font-weight: 500; }
.stat-big { font-size: 1.55rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-of { font-size: 1rem; color: var(--ink-3); font-weight: 500; }
.stat-sub { font-size: .82rem; color: var(--ink-3); }
.stat .progress-track { margin-top: .35rem; }

.split {
  display: flex; gap: 3px;
  height: 10px; margin-top: .45rem;
  border-radius: 3px; overflow: hidden;
}
.split .seg { flex: 1 1 0; min-width: 6px; }
.split .seg.l3 { background: var(--dot-good); }
.split .seg.l2 { background: var(--dot-ok); }
.split .seg.l1 { background: var(--dot-bad); }
.split .seg.none { background: var(--surface-3); }
.split-legend { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .5rem; font-size: .82rem; color: var(--ink-2); }
.split-legend span { display: inline-flex; align-items: center; gap: .35rem; font-variant-numeric: tabular-nums; }
.split-legend i { width: 7px; height: 7px; border-radius: 50%; }
.split-legend .l3 i { background: var(--dot-good); }
.split-legend .l2 i { background: var(--dot-ok); }
.split-legend .l1 i { background: var(--dot-bad); }

.empty { display: grid; justify-items: center; gap: .6rem; padding: 3rem 1.2rem; text-align: center; color: var(--ink-3); }
.empty p { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th {
  text-align: left; font-weight: 500; font-size: .76rem; color: var(--ink-3);
  padding: .65rem 1.3rem; background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: .7rem 1.3rem; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr:first-child td { border-top: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: .86rem; }
.tbl th.num { font-family: var(--font); font-size: .76rem; }
.tbl tr.is-loa .who img { opacity: .5; filter: grayscale(1); }
.tbl tr.is-loa .who b { color: var(--ink-3); }
.col-meter { width: 22%; min-width: 170px; }
.col-bar { min-width: 170px; }
.col-split { width: 16%; min-width: 120px; }
.col-split .split { margin: 0; }
.tbl .go { width: 1%; color: var(--ink-3); }
.row-title { font-weight: 500; color: var(--ink); }
.tbl-links tbody tr { cursor: pointer; }
.tbl-links .row-title::after { content: ""; position: absolute; inset: 0; }
.tbl-links tbody tr { position: relative; }
.row-sub { display: block; font-size: .78rem; }

.who { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.who img { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.who-txt { min-width: 0; }
.who b { display: block; font-weight: 500; white-space: nowrap; }
.who small { display: block; color: var(--ink-3); font-size: .76rem; white-space: nowrap; }

.tag {
  display: inline-block;
  padding: .1rem .45rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: .72rem; font-weight: 500; color: var(--ink-2);
  white-space: nowrap;
}
.tag-accent { background: var(--accent-tint); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); }

.rating {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .14rem .5rem .14rem .42rem;
  border-radius: 5px;
  font-size: .8rem; font-weight: 500;
  white-space: nowrap;
}
.rating .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rating.l1 { background: var(--bad-tint); color: var(--bad); }
.rating.l2 { background: var(--ok-tint); color: var(--ok); }
.rating.l3 { background: var(--good-tint); color: var(--good); }
.rating.l1 .dot { background: var(--dot-bad); }
.rating.l2 .dot { background: var(--dot-ok); }
.rating.l3 .dot { background: var(--dot-good); }
.login-points .rating { padding: .3rem; }

.meter { display: flex; align-items: center; gap: .75rem; }
.meter-val { min-width: 2.6rem; text-align: right; font-family: var(--mono); font-size: .86rem; font-variant-numeric: tabular-nums; }
.meter-track {
  position: relative; flex: 1;
  height: 6px; border-radius: 3px;
  background: var(--surface-3);
}
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--ink-3); }
.meter-fill.l1 { background: var(--dot-bad); }
.meter-fill.l2 { background: var(--dot-ok); }
.meter-fill.l3 { background: var(--dot-good); }
.tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink-3); opacity: .55; }

.progress { display: flex; align-items: center; gap: .7rem; }
.progress-track { position: relative; flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 3px; }
.progress-txt { font-family: var(--mono); font-size: .82rem; color: var(--ink-2); white-space: nowrap; }

.streak { color: var(--bad); font-weight: 600; }
.state-row { display: inline-flex; align-items: center; gap: .5rem; }
.state { display: inline-flex; align-items: center; gap: .3rem; font-size: .84rem; color: var(--ink-3); white-space: nowrap; }
.state.good { color: var(--good); }
.state.bad { color: var(--bad); }
.icon-link { display: inline-flex; color: var(--ink-3); }
.icon-link:hover { color: var(--ink); }

.has-tip { position: relative; cursor: default; text-decoration: underline dotted var(--ink-3); text-underline-offset: 3px; }
.tip {
  display: none;
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 5;
  min-width: 230px;
  padding: .6rem .75rem;
  background: var(--ink); color: var(--bg);
  border-radius: var(--r-sm);
  font-family: var(--font); font-size: .8rem; line-height: 1.5; text-align: left;
  box-shadow: var(--shadow-lg);
}
.tip span { display: block; white-space: nowrap; }
.has-tip:hover .tip, .has-tip:focus .tip { display: block; }

/* ---------- settings ---------- */
.settings-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 2rem; align-items: start; }
.toc { position: sticky; top: 1.5rem; display: flex; flex-direction: column; gap: 1px; border-left: 1px solid var(--line); }
.toc a { padding: .35rem 0 .35rem .9rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-3); font-size: .88rem; }
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.on { color: var(--ink); border-left-color: var(--accent); }

.field { margin-bottom: 1.2rem; }
.field:last-child { margin-bottom: 0; }
.lbl { display: block; font-size: .88rem; font-weight: 500; color: var(--ink); }
.note { display: block; font-size: .82rem; color: var(--ink-3); margin-top: .1rem; }

input[type=text], input[type=number], select, textarea {
  width: 100%;
  margin-top: .4rem;
  padding: .52rem .7rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font: inherit; font-size: .9rem;
  transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--surface-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
select {
  appearance: none; cursor: pointer; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2386827a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3.5 5.5l3.5 3.5 3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
}
textarea { resize: vertical; font-family: var(--mono); font-size: .83rem; line-height: 1.55; }

label.check { display: flex; align-items: flex-start; gap: .55rem; cursor: pointer; font-size: .9rem; }
label.check input { width: 15px; height: 15px; margin: .2rem 0 0; accent-color: var(--accent); flex-shrink: 0; }
label.check.small { font-size: .84rem; color: var(--ink-2); margin-top: .7rem; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1rem;
  margin-bottom: 1.3rem;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.switch-row b { display: block; font-weight: 500; font-size: .92rem; }
.switch-row small { display: block; color: var(--ink-3); font-size: .8rem; }
.switch-row:last-child { margin-bottom: 0; }
.msg-editor + .switch-row { margin-top: 1.3rem; }

.switch {
  appearance: none; position: relative; flex-shrink: 0;
  width: 38px; height: 22px; margin: 0;
  border-radius: 11px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3);
  transition: transform .15s;
}
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); outline: none; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1rem; }
.row2 .field { margin: 0; }
.row4 { display: grid; grid-template-columns: 1.3fr .6fr .6fr 1.5fr; gap: 0 .8rem; }
.row4 .field { margin: 0; }

.scale {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch;
  margin-bottom: 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.scale-seg { display: grid; place-items: center; padding: .9rem .5rem; }
.scale-seg .rating { background: transparent; padding: 0; font-size: .9rem; }
.scale-seg.l1 { background: var(--bad-tint); }
.scale-seg.l2 { background: var(--ok-tint); }
.scale-seg.l3 { background: var(--good-tint); }
.scale-cut {
  display: flex; flex-direction: column; justify-content: center; gap: .2rem;
  padding: .45rem .7rem;
  background: var(--surface);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  font-size: .72rem; color: var(--ink-3); text-align: center;
}
.scale-cut input { width: 86px; margin: 0; text-align: center; font-family: var(--mono); }

.points { border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 1.3rem; overflow: hidden; }
.point-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .45rem .5rem .45rem 1rem;
  border-top: 1px solid var(--line-soft);
  font-size: .9rem;
}
.point-row:first-child { border-top: 0; }
.point-row:hover { background: var(--surface-2); }
.point-input { display: inline-flex; align-items: center; gap: .5rem; }
.point-input input { width: 70px; margin: 0; text-align: center; font-family: var(--mono); }
.point-input small { color: var(--ink-3); font-size: .78rem; width: 4.2rem; }

.subsection { margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px dashed var(--line); }
.subsection h3 { margin-bottom: 1rem; }

.msg-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.msg-editor .discord { margin-top: .4rem; }

.msel-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .5rem; }
.msel-tag {
  display: inline-flex; align-items: center; gap: .1rem;
  padding: .18rem .2rem .18rem .55rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: .84rem;
}
.msel-rm {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; padding: 0;
  border: 0; border-radius: 3px; background: transparent;
  color: var(--ink-3); font-size: 1rem; line-height: 1; cursor: pointer;
}
.msel-rm:hover { background: var(--bad-tint); color: var(--bad); }
.msel-empty { font-size: .84rem; color: var(--ink-3); }
.msel-add { max-width: 320px; }

.save-bar {
  position: sticky; bottom: 1rem; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem .7rem .7rem 1.2rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.save-state { font-size: .86rem; color: var(--ink-3); }
.save-state.dirty { color: var(--ok); font-weight: 500; }

/* ---------- Discord-style preview ---------- */
.discord {
  padding: 1rem 1.1rem 1.1rem;
  background: #313338;
  border: 1px solid #3f4147;
  color: #dbdee1;
  border-radius: var(--r);
  font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: .95rem; line-height: 1.375;
}
.d-msg { display: flex; gap: .9rem; }
.d-avatar .mark { --mark-bg: #1e1f22; border-radius: 50%; }
.d-body { min-width: 0; flex: 1; }
.d-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .1rem; }
.d-head b { color: #f2f3f5; font-weight: 600; }
.d-bot { padding: 0 .28rem; border-radius: 3px; background: #5865f2; color: #fff; font-size: .62rem; font-weight: 600; line-height: 1.35; }
.d-time { color: #949ba4; font-size: .74rem; margin-left: .15rem; }
.d-line { white-space: pre-wrap; word-break: break-word; }
.d-line.h1 { font-size: 1.45rem; font-weight: 700; color: #f2f3f5; margin: .5rem 0 .1rem; line-height: 1.25; }
.d-line.h2 { font-size: 1.2rem; font-weight: 700; color: #f2f3f5; }
.d-line.small { font-size: .78rem; color: #949ba4; }
.d-line.mention span { padding: 0 .15rem; border-radius: 3px; background: rgba(88,101,242,.3); color: #c9cdfb; font-weight: 500; }
.d-react {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-top: .45rem; padding: .12rem .45rem;
  background: rgba(88,101,242,.15); border: 1px solid #5865f2; border-radius: 8px;
  font-size: .82rem; color: #c9cdfb;
}

/* ---------- flash ---------- */
.flash {
  padding: .75rem 1rem;
  margin-bottom: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: .9rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.flash.ok { border-color: color-mix(in srgb, var(--good) 35%, transparent); background: var(--good-tint); color: var(--good); }
.flash.error { border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-tint); color: var(--bad); }

/* ---------- footer, legal ---------- */
.foot { display: flex; justify-content: center; gap: 1.2rem; padding: 1.4rem; font-size: .8rem; }
.foot a { color: var(--ink-3); }
.legal { max-width: 660px; margin: 1rem auto 0; }
.legal h1 { margin-bottom: .3rem; }
.legal h2 { margin: 2rem 0 .5rem; }
.legal p, .legal li { color: var(--ink-2); }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: .35rem; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .settings-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .login { grid-template-columns: 1fr; gap: 3rem; min-height: 0; padding-top: 1rem; }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 10;
    flex-direction: row; align-items: center; gap: .4rem;
    overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: .5rem .7rem;
  }
  .s-brand, .s-server-txt, .s-switch, .s-label, .s-foot .nm { display: none; }
  .s-server { padding: .3rem; }
  .s-nav { flex-direction: row; flex: 1; margin: 0; }
  .s-nav a.active::before { display: none; }
  .s-foot { margin: 0; padding: 0; border: 0; }
  .content .inner { padding: 1.6rem 1rem 2rem; }
  .msg-editor { grid-template-columns: 1fr; }
  .row4 { grid-template-columns: 1fr 1fr; gap: .9rem .8rem; }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .s-nav a span { display: none; }
  .scale { grid-template-columns: 1fr; }
  .scale-cut { flex-direction: row; align-items: center; justify-content: space-between; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  h1 { font-size: 1.45rem; }
}
