/* The dashboard's design (loaded after app.css, which holds the pages' own parts).
   Themes are colour sets only, on <html data-theme="…">: they set the tokens below
   and every part of the page picks them up. "Standard" is data-theme="dark" or
   "light"; Borsippa's Standard is pink instead of blurple. A person's own accent
   (Appearance) is set inline on <html> by app.js and wins over the theme's. */

:root, [data-theme="dark"] {
  --bg: #0e0f13; --card: #15171c; --raised: #1b1e24; --hover: #20242b; --line: #262a32; --line-2: #31363f;
  --text: #c9ccd3; --head: #f1f2f5; --muted: #858b97; --faint: #5d636e;
  --accent: #5865f2; --on-accent: #ffffff;
}
[data-theme="light"] {
  --bg: #f4f5f7; --card: #ffffff; --raised: #f7f8fa; --hover: #eef0f3; --line: #e3e5e9; --line-2: #d4d7dd;
  --text: #3a3f48; --head: #111318; --muted: #656b76; --faint: #80868f;
  --accent: #5865f2; --on-accent: #ffffff;
}
[data-theme="midnight"] {
  --bg: #070b18; --card: #0d1430; --raised: #141d40; --hover: #18234c; --line: #1f2a52; --line-2: #2d3a6e;
  --text: #c6d0ee; --head: #e6ecfd; --muted: #93a0c6; --faint: #5f6b93;
  --accent: #8fbaff; --on-accent: #07102a;
}
[data-theme="sakura"] {
  --bg: #fff1f6; --card: #fffafc; --raised: #ffeef4; --hover: #ffe4ee; --line: #f4d2df; --line-2: #ebbbcd;
  --text: #5a3a48; --head: #3b2430; --muted: #855d6d; --faint: #a17a8a;
  --accent: #d94f86; --on-accent: #ffffff;
}
[data-theme="frost"] {
  --bg: #eaf2fb; --card: #f8fbff; --raised: #eff5fc; --hover: #e3edf9; --line: #d3e2f2; --line-2: #b9cfe7;
  --text: #2c3e52; --head: #1c2a3a; --muted: #566c84; --faint: #738aa1;
  --accent: #2f7fd1; --on-accent: #ffffff;
}
[data-theme="ember"] {
  --bg: #140c0a; --card: #1d1210; --raised: #271814; --hover: #2e1c17; --line: #38231c; --line-2: #4b2f25;
  --text: #e6d3ca; --head: #f6ebe5; --muted: #b7988a; --faint: #7d6157;
  --accent: #ff8a3d; --on-accent: #1c0a02;
}
[data-theme="aurora"] {
  --bg: #030a10; --card: #07131b; --raised: #0c1d26; --hover: #10242e; --line: #152f39; --line-2: #1f414e;
  --text: #c4e3dd; --head: #e3f7f3; --muted: #8db5b0; --faint: #557b79;
  --accent: #4df0b0; --on-accent: #02201a;
}
[data-theme="factory"] {
  --bg: #15191e; --card: #1b2027; --raised: #222930; --hover: #283038; --line: #2f3740; --line-2: #3d4651;
  --text: #d5dade; --head: #eef0f2; --muted: #9ba5af; --faint: #67727d;
  --accent: #f5c542; --on-accent: #1a1400;
}
[data-theme="nebula"] {
  --bg: #08061a; --card: #0e0b25; --raised: #16123a; --hover: #1b1645; --line: #241e4c; --line-2: #33295f;
  --text: #d6d1f2; --head: #efecff; --muted: #a59dca; --faint: #6b6390;
  --accent: #b18cff; --on-accent: #14072e;
}
[data-theme="field"] {
  --bg: #171b21; --card: #1d2228; --raised: #242a31; --hover: #2a3139; --line: #30373f; --line-2: #3e4650;
  --text: #d7dbdf; --head: #eceef0; --muted: #a7afb8; --faint: #6d7681;
  --accent: #a8c070; --on-accent: #141a08;
}
/* Borsippa's Standard: her lotus pink */
html[data-bot="sis"][data-theme="dark"], html[data-bot="sis"] [data-theme="dark"],
html[data-bot="sis"][data-theme="light"], html[data-bot="sis"] [data-theme="light"] { --accent: #e0559c; --on-accent: #ffffff; }

/* what follows from the theme: dark or light, and the accent's softer and readable forms */
:root, [data-theme] {
  --side: var(--card); --deep: color-mix(in srgb, var(--bg) 72%, #000);
  --soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --hi: color-mix(in srgb, var(--accent) 72%, #fff);
  --sel: color-mix(in srgb, var(--accent) 12%, var(--card));
  --accent-2: var(--hi); --link: var(--hi); --pop: var(--raised);
  --green: #3ba55d; --red: #e5484d; --yellow: #e5a33a;
  --shadow: 0 12px 32px rgba(0, 0, 0, .45);
  --r: 10px; --r-sm: 7px;
  color-scheme: dark;
}
[data-theme="light"], [data-theme="sakura"], [data-theme="frost"] {
  --deep: var(--bg); --soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --hi: color-mix(in srgb, var(--accent) 82%, #000); --pop: var(--card);
  --green: #1f8f4e; --red: #d1373c; --yellow: #a86f0c;
  --shadow: 0 12px 30px rgba(20, 25, 40, .13);
  color-scheme: light;
}

/* ── base ── */
body { background: var(--bg); color: var(--text); font: 14.5px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h1 { color: var(--head); font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; margin: 0 0 4px; text-wrap: balance; }
.lead { color: var(--muted); max-width: 70ch; margin: 0 0 18px; }
a { color: var(--link); }
code { background: var(--raised); color: var(--head); }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: 2px solid var(--hi); outline-offset: 2px; }
main.enter > * { animation: none; }
[data-density="compact"] .row { padding-top: 7px; padding-bottom: 7px; }
[data-density="compact"] .card { padding-top: 12px; padding-bottom: 12px; }
[data-motion="reduced"] *, [data-motion="reduced"] *::before, [data-motion="reduced"] *::after { transition: none !important; animation: none !important; }

/* ── buttons: plain ones, and the shared kinds (special buttons keep their own shape) ── */
button:where(:not([class], [role="tab"]):not(:is(.seg, .tabs, .sq-tabs, .emo-tabs, .bg-status, .ed-states, .ed-own, .sq-sugg,
    .an-block-acts, .ap-vote, .ap-chips, .tabbar, .sn-list, .pal-list, .th-grid, .sw-pop) button)),
:is(button.pri, button.ok, button.ghost, button.bad) {
  border: 1px solid var(--line-2); background: var(--raised); color: var(--head); border-radius: var(--r-sm); padding: 6px 13px;
  font-weight: 600; font-size: 13.5px; transition: background .12s, border-color .12s; }
button:where(:not([class], [role="tab"]):not(:is(.seg, .tabs, .sq-tabs, .emo-tabs, .bg-status, .ed-states, .ed-own, .sq-sugg,
    .an-block-acts, .ap-vote, .ap-chips, .tabbar, .sn-list, .pal-list, .th-grid, .sw-pop) button)):hover { background: var(--hover); }
button:active { transform: none; }
button.pri, button.ok { background: var(--accent); border-color: transparent; color: var(--on-accent); box-shadow: none; }
button.pri:hover, button.ok:hover { background: var(--accent); filter: brightness(1.08); }
button.ghost { background: none; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--hover); color: var(--head); }
button.bad { background: color-mix(in srgb, var(--red) 12%, transparent); border-color: color-mix(in srgb, var(--red) 30%, transparent);
             color: var(--red); box-shadow: none; }
button.bad:hover { background: color-mix(in srgb, var(--red) 20%, transparent); }
button:disabled { opacity: .5; cursor: default; }
.btn-discord { background: var(--accent); color: var(--on-accent); border-radius: var(--r-sm); }
.btn-discord:hover { background: var(--accent); filter: brightness(1.08); }

/* ── cards and rows ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; }
.card h3 { color: var(--head); font-size: 13.5px; font-weight: 650; margin: 0 0 8px; }
.row { border-top-color: var(--line); padding: 11px 0; min-height: 50px; }
.row .lbl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row .lbl b { font-weight: 550; color: var(--head); }
.row .lbl > span:not(.info) { flex-basis: 100%; }
.info { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; border-radius: 50%;
        border: 1px solid var(--line-2); color: var(--faint); font: 700 10.5px/1 system-ui, sans-serif; cursor: help; }
.info:hover, .info:focus { color: var(--head); border-color: var(--muted); outline: none; }
.info:hover::after, .info:focus::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
        width: max-content; max-width: min(280px, 80vw); background: var(--head); color: var(--bg); font: 500 12.5px/1.45 system-ui, sans-serif;
        padding: 7px 10px; border-radius: 7px; z-index: 70; white-space: normal; text-align: left; box-shadow: var(--shadow); }
.sub { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); }
.sub .row { border-color: var(--line); }
.sub input[type=text], .sub input[type=number], .sub select, .sub .pick-btn { background: var(--deep); border-color: var(--line-2); }
.notice { background: color-mix(in srgb, var(--yellow) 13%, transparent); color: var(--head); border: 1px solid color-mix(in srgb, var(--yellow) 30%, transparent);
          border-radius: var(--r); }
.notice b { color: var(--head); }
.sentence, .pre { background: var(--raised); border-radius: var(--r-sm); }
.status { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }

/* ── inputs ── */
input[type=text], input[type=search], input[type=number], input[type=url], select, textarea, .pick-btn {
  background: var(--deep); border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--head); }
input:hover, select:hover, textarea:hover, .pick-btn:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus, .pick-btn[aria-expanded=true] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.pick-btn.add { background: none; border: 1px dashed var(--line-2); color: var(--muted); }
.seg { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg button { border: 0; border-radius: 5px; background: none; color: var(--muted); box-shadow: none; padding: 5px 11px; font-weight: 600; font-size: 13px; }
.seg button:hover { background: var(--hover); color: var(--head); }
.seg button.on { background: var(--card); color: var(--head); box-shadow: 0 1px 2px rgba(0, 0, 0, .22); }
.sw i { background: var(--line-2); border: 0; }
.sw i::after { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.sw input:checked + i { background: var(--accent); }
.sw.part input:checked + i { opacity: .55; }
.tabs { display: flex; border-bottom: 1px solid var(--line); gap: 2px; margin: 0 0 14px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); font-weight: 600;
               margin-bottom: -1px; padding: 9px 12px; white-space: nowrap; box-shadow: none; }
.tabs button:hover { background: none; color: var(--head); }
.tabs button.on { background: none; color: var(--head); border-bottom-color: var(--accent); }

/* ── chips, badges, counts ── */
.chip, .role { background: var(--raised); border: 1px solid var(--line-2); border-radius: 6px; color: var(--text); }
.chip .x:hover, .role .x:hover { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.badge { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); border-radius: 5px; padding: 1px 7px; }
.badge.chg { background: var(--hover); color: var(--text); }
/* on pale themes, text in a chip's own colour (--c) is darkened so it stays readable */
:is([data-theme="light"], [data-theme="sakura"], [data-theme="frost"]) :is(.badge, .bl-chip, .sp-tag) { color: color-mix(in srgb, var(--c) 62%, #000); }
:is([data-theme="light"], [data-theme="sakura"], [data-theme="frost"]) .lv-rank.top1 { color: #b8860b; }
:is([data-theme="light"], [data-theme="sakura"], [data-theme="frost"]) .lv-rank.top2 { color: #7d8590; }
:is([data-theme="light"], [data-theme="sakura"], [data-theme="frost"]) .lv-rank.top3 { color: #b0662e; }
.pill { background: var(--red); color: #fff; font-variant-numeric: tabular-nums; }
.tag-new { background: var(--soft); color: var(--hi); }
.dot { background: var(--c, var(--faint)); }

/* ── tables ── */
th { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; color: var(--faint); padding: 10px 12px; border-bottom-color: var(--line); }
td { padding: 10px 12px; border-bottom-color: var(--line); }
table.cases tbody tr:hover, table.cases tbody tr:focus { background: var(--hover); }
table.cases tbody tr.sel, .ap-item.sel, .bl-row.sel, .sp-entry.sel { background: var(--sel); }
tr.ghead td { background: var(--raised); }

/* ── pickers, drawers, dialogs, save bar, toast ── */
.pop { background: var(--pop); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); }
.pop input { background: var(--deep); }
.opt { border-radius: 6px; color: var(--text); }
.opt:hover { background: var(--hover); }
.opt.active { background: var(--accent); color: var(--on-accent); }
.opt.active .pre-x, .opt.active .opt-note { color: inherit; opacity: .8; }
.pop.sheet::before { background: var(--line-2); }
.scrim, .modal-scrim, .sheet-scrim, .dr-modal-back { background: rgba(4, 5, 9, .55); }
.drawer { background: var(--card); border-left: 1px solid var(--line); box-shadow: var(--shadow); }
.modal { background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); }
.modal-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; margin: 20px 20px -6px; background: var(--soft); color: var(--hi); }
.modal-ic.bad { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }
.modal-ic svg { width: 21px; height: 21px; }
.modal-btns { background: none; border-top: 1px solid var(--line); }
.savebar { left: calc(50% + 116px); background: var(--head); color: var(--bg); border: 0; border-radius: 12px; box-shadow: var(--shadow);
           width: auto; max-width: calc(100% - 32px); padding: 8px 8px 8px 16px; font-weight: 600; pointer-events: none; }
.savebar.show { pointer-events: auto; }
.savebar span { flex: 1; white-space: nowrap; }
.savebar button { background: transparent; color: var(--bg); border-color: transparent; }
.savebar button:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
.savebar button.ok { background: var(--accent); color: var(--on-accent); }
.toast { background: var(--card); color: var(--head); border: 1px solid var(--line-2); border-left: 4px solid var(--green); border-radius: var(--r); }
.toast.err { background: var(--card); border-left-color: var(--red); }
.sk { background: linear-gradient(90deg, var(--card) 0, var(--raised) 50%, var(--card) 100%); background-size: 800px 100%; }

/* ── login ── */
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); animation: none; }
.login-card .logo { filter: none; }

/* Discord previews keep Discord's own colours */
.dm { --bg: #313338; --side: #2b2d31; --card: #2b2d31; --deep: #1e1f22; --raised: #383a40; --line: #3f4147; --text: #dbdee1;
      --muted: #949ba4; --head: #f2f3f5; --link: #00a8fc; background: #313338; border-color: #3f4147; color: #dbdee1; color-scheme: dark; }

/* ── the shell: one menu grouped by topic, and on phones a top bar and tabs ── */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--card);
        border-right: 1px solid var(--line); z-index: 46; }
.sn-brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; min-width: 0; }
.sn-brand img { width: 30px; height: 30px; flex: none; }
.sn-brand b { display: block; color: var(--head); font-size: 14.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-brand span { color: var(--muted); font-size: 12px; }
.side .sis-switch { margin: 8px 10px 4px; width: calc(100% - 20px); }
.sn-search { display: flex; align-items: center; gap: 8px; margin: 2px 10px 6px; padding: 7px 10px; border: 1px solid var(--line);
             border-radius: var(--r-sm); background: var(--raised); color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.sn-search:hover { border-color: var(--line-2); color: var(--text); }
.sn-search svg { width: 16px; height: 16px; flex: none; }
.sn-search kbd { margin-left: auto; font: 11px system-ui, sans-serif; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.sn-list { flex: 1; overflow-y: auto; padding: 0 10px 10px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.sn-grp { color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; padding: 14px 10px 4px; }
.sn { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px; border-radius: var(--r-sm); color: var(--muted);
      text-decoration: none; font-weight: 500; position: relative; }
.sn:hover { background: var(--hover); color: var(--text); }
.sn.on { background: var(--soft); color: var(--head); }
.sn.on .line-ic { color: var(--hi); }
.sn .line-ic { width: 18px; height: 18px; flex: none; }
.sn-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn .pill { font-size: 11px; line-height: 17px; padding: 0 6px; border-radius: 9px; }
.sn .tagx { font-size: 9.5px; font-weight: 700; letter-spacing: .03em; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; color: var(--muted); }
.sn-me { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); min-width: 0; }
.sn-me > div { flex: 1; min-width: 0; }
.sn-me b { display: block; color: var(--head); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-me span { color: var(--muted); font-size: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; background: none; color: var(--muted);
            border-radius: var(--r-sm); padding: 0; cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--hover); color: var(--head); }
.icon-btn .line-ic { width: 18px; height: 18px; }
.mainwrap { min-width: 0; }
.mainwrap > main { padding: 24px clamp(16px, 3vw, 36px) 100px; max-width: 1240px; width: 100%; }
.mtop, .mscrim, .tabbar { display: none; }

/* search: Ctrl/Cmd + K */
.pal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh;
       background: rgba(4, 5, 9, .5); }
.pal[hidden] { display: none; }
.pal-box { width: min(560px, calc(100% - 24px)); background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.pal-box input { width: 100%; border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; background: none !important;
                 box-shadow: none !important; padding: 14px 16px; font-size: 15px; color: var(--head); }
.pal-list { max-height: 56vh; overflow-y: auto; padding: 6px; }
.pal-list button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 7px;
                   color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pal-list button .line-ic { width: 17px; height: 17px; color: var(--muted); flex: none; }
.pal-list button.on, .pal-list button:hover { background: var(--hover); color: var(--head); }
.pal-list small { margin-left: auto; color: var(--faint); font-size: 12px; }
.pal-empty { color: var(--muted); padding: 16px; text-align: center; }

/* ── Appearance ── */
.th-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; }
.th { border: 1px solid var(--line); border-radius: var(--r); padding: 0; background: var(--card); cursor: pointer; text-align: left; overflow: hidden;
      display: grid; color: var(--text); font: inherit; }
.th:hover { border-color: var(--line-2); }
.th.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--soft); }
.th-cap { padding: 8px 10px 9px; display: grid; gap: 1px; background: var(--card); }
.th-cap b { color: var(--head); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.th-cap b .line-ic { width: 14px; height: 14px; color: var(--hi); margin-left: auto; }
.th-cap span { color: var(--muted); font-size: 11.5px; }
.th-mini { display: grid; grid-template-columns: 22% 1fr; height: 88px; background: var(--bg); border-bottom: 1px solid var(--line); }
.th-mini .s { background: var(--card); border-right: 1px solid var(--line); padding: 8px 5px; display: grid; gap: 5px; align-content: start; }
.th-mini .s i { height: 5px; border-radius: 3px; background: var(--line-2); }
.th-mini .s i.a { background: var(--accent); }
.th-mini .m { padding: 8px; display: grid; gap: 6px; align-content: start; }
.th-mini .t { background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: 5px 6px; display: grid; gap: 4px; }
.th-mini .t i { height: 4px; border-radius: 2px; background: var(--muted); width: 60%; }
.th-mini .t i.h { background: var(--head); width: 35%; height: 6px; }
.th-mini .r { display: flex; gap: 5px; align-items: center; }
.th-mini .b { height: 12px; width: 34px; border-radius: 4px; background: var(--accent); }
.th-mini .k { height: 10px; width: 18px; border-radius: 6px; background: var(--accent); position: relative; margin-left: auto; }
.th-mini .k::after { content: ""; position: absolute; right: 2px; top: 2px; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.th-mini .g { height: 12px; width: 26px; border-radius: 4px; background: var(--raised); border: 1px solid var(--line-2); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line-2); background: var(--c);
          cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.swatch.on { box-shadow: 0 0 0 2px var(--head); }
.swatch.theme { background: conic-gradient(var(--accent) 0 50%, var(--raised) 0); }
.swatch.own { background: conic-gradient(#f23f43, #f0b232, #23a55a, #1abc9c, #5865f2, #eb459e, #f23f43); }
.swatch.own input { position: absolute; inset: -6px; opacity: 0; cursor: pointer; width: auto; height: auto; }

/* ── tablets: an icon rail ── */
@media (max-width: 1100px) and (min-width: 721px) {
  .shell { grid-template-columns: 64px minmax(0, 1fr); }
  .side { align-items: center; }
  .sn-brand { padding: 14px 0 10px; justify-content: center; }
  .sn-brand > div, .sn-grp, .sn-lbl, .sn .tagx, .sn-search span, .sn-search kbd, .sn-me > div, .sn-me .logout,
  .side .sis-switch .sw-txt, .side .sis-switch .sw-chev { display: none; }
  .side .sis-switch { width: 44px; margin: 8px 0 4px; padding: 6px; }
  .sn-search { width: 40px; justify-content: center; margin: 2px 0 6px; padding: 8px; }
  .sn-list { padding: 6px 10px 10px; width: 100%; }
  .sn { justify-content: center; padding: 0; min-height: 40px; }
  .sn .pill { position: absolute; top: 2px; right: 2px; font-size: 10px; line-height: 15px; padding: 0 4px; }
  .sn-me { justify-content: center; padding: 10px 0; flex-direction: column; gap: 4px; }
  .savebar { left: calc(50% + 32px); }
}

/* ── phones: a top bar, a slide-in menu and tabs at the bottom ── */
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform .22s ease;
          box-shadow: var(--shadow); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .shell.nav-open .side { transform: none; }
  .mscrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(4, 5, 9, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .shell.nav-open .mscrim { opacity: 1; pointer-events: auto; }
  .mtop { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 35; padding: 8px 10px;
          padding-top: max(8px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(10px);
          border-bottom: 1px solid var(--line); }
  .mtop b { flex: 1; min-width: 0; color: var(--head); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mainwrap > main { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 36;
            padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 94%, transparent);
            backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { position: relative; display: grid; justify-items: center; gap: 2px; padding: 5px 0; border: 0; background: none;
                              color: var(--muted); font: 600 10.5px system-ui, sans-serif; text-decoration: none; min-width: 0; cursor: pointer; }
  .tabbar .line-ic { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--hi); }
  .tab-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .tabbar .pill { position: absolute; top: 0; left: calc(50% + 4px); font-size: 10px; line-height: 15px; padding: 0 4px; border-radius: 8px; }
  .savebar { left: 50%; bottom: calc(70px + env(safe-area-inset-bottom)); }
  .toast { bottom: auto; }
  .pal { padding-top: 8vh; }
}
@media (pointer: coarse) { .sn { min-height: 42px; } }

/* ── Overview (overview.js) ── */
.ov-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.ov-top h1 { margin: 0; }
.ov-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.ov-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.ov-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.ov-tile { display: grid; gap: 1px; margin: 0; padding: 13px 15px 11px; }
.ov-lab { color: var(--muted); font-size: 12.5px; }
.ov-num { color: var(--head); font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.ov-delta { color: var(--muted); font-size: 12px; }
.ov-delta.up { color: var(--green); } .ov-delta.down { color: var(--red); }
.ov-spark { display: flex; align-items: flex-end; gap: 3px; height: 28px; margin-top: 7px; }
.ov-spark i { flex: 1; height: var(--h); min-height: 2px; background: var(--accent); opacity: .5; border-radius: 2px 2px 0 0; }
.ov-spark i:last-child, .ov-spark i:hover { opacity: 1; }
.ov-spark i.none { background: var(--line-2); opacity: .5; height: 2px; }
.ov-two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
.ov-card { padding: 0; overflow: hidden; }
.ov-head { display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-bottom: 1px solid var(--line); min-height: 48px; }
.ov-head h3 { margin: 0; flex: 1; font-size: 13.5px; }
.ov-head .seg button { padding: 3px 9px; font-size: 12px; }
.ov-pad { padding: 12px 16px; margin: 0; }
.ov-list > * + * { border-top: 1px solid var(--line); }
.ov-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: inherit; text-decoration: none; min-width: 0; }
a.ov-item:hover { background: var(--hover); }
.ov-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--raised); color: var(--muted); }
.ov-ic .line-ic { width: 17px; height: 17px; }
.ov-ic.warn { color: var(--yellow); background: color-mix(in srgb, var(--yellow) 13%, transparent); }
.ov-ic.bad { color: var(--red); background: color-mix(in srgb, var(--red) 13%, transparent); }
.ov-ic.info { color: var(--hi); background: var(--soft); }
.ov-t { flex: 1; min-width: 0; display: grid; }
.ov-t b { color: var(--head); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-t span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-when { color: var(--faint); font-size: 12px; white-space: nowrap; }
.ov-go { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 4px 10px; color: var(--head); font-weight: 600; font-size: 13px; white-space: nowrap; }
.ov-go:hover { background: var(--hover); color: var(--head); }
.ov-clear { display: flex; align-items: center; gap: 8px; padding: 14px 16px; color: var(--muted); }
.ov-clear .line-ic { width: 18px; height: 18px; color: var(--green); }
.ov-news { padding: 9px 16px; }
.ov-news summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.ov-news summary::-webkit-details-marker { display: none; }
.ov-news summary b { color: var(--head); font-weight: 600; flex: 1; min-width: 0; }
.ov-news p { margin: 6px 0 2px; color: var(--muted); font-size: 13px; }
.ft-body { padding: 0 16px 14px; }
.ft-grp { color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; padding: 14px 0 7px; }
.ft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 8px; }
.ft { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm);
      background: var(--raised); color: var(--text); min-width: 0; }
.ft:hover { border-color: var(--line-2); }
.ft > .line-ic { width: 18px; height: 18px; flex: none; color: var(--muted); }
.ft-t { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.ft-t b { color: var(--head); font-weight: 600; font-size: 13.5px; line-height: 1.25; overflow: hidden; overflow-wrap: anywhere;
           display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }   /* long names take a second line */
.ft-t > span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ft-link { display: block; min-width: 0; overflow: hidden; color: inherit; text-decoration: none; }
.ft-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.ft-sw, .ft-state, .ft-lock { position: relative; z-index: 1; flex: none; }
.ft-state { font-size: 11.5px; font-weight: 650; color: var(--faint); }
.ft-state.on { color: var(--green); }
.ft.off .ft-t b { color: var(--muted); }
.ft.core { background: none; border-style: dashed; }
.ft-lock { width: 15px; height: 15px; color: var(--faint); }
.ft-foot { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.ft-foot > span { display: inline-flex; align-items: center; gap: 6px; }
.card.feat-sw { padding-top: 6px; padding-bottom: 6px; margin-bottom: 14px; }
.ft-foot .grow { flex: 1; }
@media (max-width: 1100px) {
  .ov-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .ov-tiles { gap: 10px; }
  .ov-tile { padding: 11px 12px 10px; }
  .ov-num { font-size: 20px; }
  .ft-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .ov-head .seg { overflow-x: auto; }
}

/* ── WT news (wtnews.js) ── */
.wn-pad { padding: 0 2px; margin: 10px 0 4px; }
.wn-pad.bad { color: var(--red); }
.wn-cat { display: grid; grid-template-columns: 12px minmax(0, 1fr) minmax(150px, 210px) auto; gap: 12px; align-items: center;
          padding: 10px 0; border-top: 1px solid var(--line); }
.wn-cat:first-of-type { border-top: 0; }
.wn-sw { width: 12px; height: 12px; border-radius: 4px; background: var(--c); }
.wn-what { min-width: 0; display: grid; }
.wn-what b { color: var(--head); font-weight: 600; }
.wn-what small { color: var(--muted); font-size: 12.5px; }
.wn-what a, .wn-what .ell { color: var(--head); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.wn-what a:hover { color: var(--hi); }
.wn-cat.off .wn-what b { color: var(--muted); }
.wn-cat.off .wn-sw { opacity: .35; }
.wn-noping { color: var(--faint); font-size: 12px; }
.wn-group { margin-top: 12px; }
.wn-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0 6px;
                 border-bottom: 1px solid var(--line); }
.wn-group-head b { color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.wn-group-head .seg button { font-size: 12px; padding: 3px 9px; }
.wn-group .wn-cat:first-of-type { border-top: 0; }
.wn-looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 6px 0 4px; }
.wn-look { display: grid; gap: 4px; justify-items: start; text-align: left; padding: 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
           background: var(--raised); color: var(--text); cursor: pointer; }
.wn-look:hover { border-color: var(--accent); }
.wn-look.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.wn-look b { color: var(--head); font-size: 13.5px; }
.wn-look small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.wn-sk { width: 100%; height: 78px; align-content: start; display: grid; gap: 4px; padding: 7px 8px; margin-bottom: 4px; border-radius: 6px; background: #2b2d31;
         border-left: 3px solid #9b7bea; }
.wn-sk > div { min-height: 5px; }
.wn-sk-t { height: 5px; border-radius: 3px; background: #5c5f66; }
.wn-sk-s { height: 5px; width: 45%; border-radius: 3px; background: #9b7bea; }
.wn-sk-f { height: 4px; width: 60%; border-radius: 3px; background: #43464d; }
.wn-sk-p { height: 30px; border-radius: 4px; background: linear-gradient(180deg, #8d78d6, #3d2f72); }
.wn-sk-q { display: grid; grid-template-columns: 1fr 18px; gap: 6px; align-items: start; }
.wn-sk-q > div { display: grid; gap: 4px; }
.wn-sk-q i { display: block; height: 5px; border-radius: 3px; background: #5c5f66; }
.wn-sk-q i.sh { width: 60%; }
.wn-sk-q b { height: 18px; border-radius: 4px; background: #9b7bea; }
.wn-sk-h { display: flex; gap: 6px; align-items: center; padding-bottom: 4px; border-bottom: 1px solid #43464d; }
.wn-sk-h b { width: 12px; height: 12px; border-radius: 3px; background: #9b7bea; }
.wn-sk-h i { height: 5px; width: 50%; border-radius: 3px; background: #b9a6f3; }
.wn-sk-b { display: flex; gap: 4px; }
.wn-sk-b i { height: 8px; width: 34%; border-radius: 3px; background: #4e5058; }
.wn-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.wn-row:first-child { border-top: 0; }
.wn-row .wn-what { flex: 1; }
@media (max-width: 720px) {
  .wn-cat { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .wn-cat > :nth-child(3) { grid-column: 2 / 4; grid-row: 2; }
}

/* ── Squadron settings: finding the squadron ── */
.sq-current { display: inline-flex; gap: 10px; align-items: baseline; }
.sq-current b { color: var(--head); }
.sq-find { display: flex; gap: 8px; padding: 6px 0 8px; }
.sq-find .grow { flex: 1; min-width: 0; }
.sq-found { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; margin-bottom: 8px;
            border-radius: var(--r-sm); border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line));
            background: color-mix(in srgb, var(--green) 8%, var(--card)); }
.sq-found > div { display: grid; min-width: 0; }
.sq-found b { color: var(--head); }
.sq-found small { color: var(--muted); font-size: 12.5px; }
.sq-hint { margin: 0 0 8px; }

/* ── Social alerts (social.js) ── */
.sa-card { padding-top: 6px; padding-bottom: 6px; }
.sa-pad { padding: 0 2px; margin: 10px 0 4px; }
.sa-pad.bad { color: var(--red); }
.sa-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0 12px; border-bottom: 1px solid var(--line); }
.sa-head b { color: var(--head); font-size: 15px; }
.sa-head span { color: var(--muted); font-size: 13px; }
.sa-acc { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 0;
          border-top: 1px solid var(--line); }
.sa-head + .sa-acc, .sa-form + .sa-acc { border-top: 0; }
.sa-acc.off .sa-what b { color: var(--muted); }
.sa-ph { position: relative; width: 40px; height: 40px; }
.sa-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--raised); display: block; }
.sa-badge { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--card);
            background: var(--muted) center / 10px no-repeat; }
.sa-badge.twitch { background-color: #9146ff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M4 2 2.5 6v14h5v3h3l3-3h4l5-5V2H4zm16 12-3 3h-4.5l-3 3v-3H5V4h15v10zm-4-7h-2v6h2V7zm-5 0H9v6h2V7z'/%3E%3C/svg%3E"); }
.sa-badge.youtube { background-color: #ff0033;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M8 5.5v13l11-6.5z'/%3E%3C/svg%3E"); }
.sa-kinds { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sa-kind-own { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding: 0 0 8px; }
.sa-what { min-width: 0; display: grid; }
.sa-what b { color: var(--head); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-what small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.sa-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.sa-chip { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); background: var(--raised); color: var(--text); }
.sa-chip.live { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.sa-chip.bad { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); white-space: normal; }
.sa-chip.warn { color: var(--yellow); border-color: color-mix(in srgb, var(--yellow) 35%, var(--line)); }
.sa-form { display: grid; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.sa-form > .seg { justify-self: start; margin-bottom: 8px; }
.sa-edit { margin: 0 0 4px 52px; padding-top: 4px; border-bottom: 0; }
.sa-find { display: flex; gap: 8px; }
.sa-find .sa-q { flex: 1; min-width: 0; }
.sa-found { display: flex; gap: 12px; align-items: center; margin: 8px 0 4px; padding: 10px 12px; border-radius: var(--r-sm);
            border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line)); background: color-mix(in srgb, var(--green) 8%, var(--card)); }
.sa-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sa-asks { display: grid; gap: 6px; padding: 12px 0 4px; border-top: 1px solid var(--line); justify-items: start; }
.sa-ask { display: grid; gap: 4px; width: 100%; padding: 6px 0; }
.sa-ask-state { margin: 0; }
.sa-ask-state.bad { color: var(--red); }
.sr-card { display: grid; gap: 10px; }
.sr-head { display: flex; align-items: center; gap: 12px; }
.sr-gi { width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center; object-fit: cover;
         background: var(--raised); color: var(--head); font-weight: 700; font-size: 13px; }
.sr-head > div { flex: 1; min-width: 0; display: grid; }
.sr-head b { color: var(--head); }
.sr-head small { color: var(--muted); font-size: 12.5px; }
.sr-why { margin: 0; padding: 6px 12px; border-left: 3px solid var(--line-2); color: var(--text); white-space: pre-wrap; }
.sr-act { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sr-act .grow { flex: 1; min-width: 180px; }
.sr-act input.num { width: 72px; }
.sa-btns .sa-rm { margin-left: auto; }
@media (max-width: 640px) {
  .sa-acc { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .sa-acc > button { grid-column: 2; grid-row: 2; justify-self: start; }
  .sa-edit { margin-left: 0; }
}

/* ── Role panels (settings.js): roles | Discord preview ── */
.rp-card { padding-top: 4px; }
.rp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.rp-head b { color: var(--head); font-size: 15px; }
.rp-head span { color: var(--muted); font-size: 13px; }
.rp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 18px; align-items: start; }
.rp-list { min-width: 0; }
.rp-entry { display: grid; grid-template-columns: 24px 44px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px 0;
            border-top: 1px solid var(--line); }
.rp-entry:first-child { border-top: 0; }
.rp-entry.dragging { opacity: .45; }
.rp-entry.drop { box-shadow: inset 0 2px 0 var(--accent); }
.rp-grip { display: grid; justify-items: center; gap: 1px; padding-top: 2px; }
.rp-grip .mini { padding: 0 4px; min-height: 18px; font-size: 11px; }
.rp-dots { color: var(--faint); cursor: grab; letter-spacing: -2px; font-size: 14px; line-height: 1; padding: 2px 0; user-select: none; }
.rp-emo { position: relative; width: 44px; height: 44px; padding: 0; border-radius: 10px; border: 1px solid var(--line-2); background: var(--raised);
          display: grid; place-items: center; font-size: 22px; cursor: pointer; }
.rp-emo:hover { border-color: var(--accent); }
.rp-emo.empty { color: var(--faint); font-size: 18px; }
.rp-emo img { width: 26px; height: 26px; object-fit: contain; }
.rp-auto { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 700; letter-spacing: .04em;
           background: var(--hover); color: var(--muted); border-radius: 4px; padding: 0 4px; line-height: 14px; }
.rp-body { min-width: 0; display: grid; gap: 7px; }
.rp-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-hint { color: var(--muted); font-size: 12px; }
.rp-entry.high .rp-top::after { content: "above the bot: can't be handed out"; color: var(--red); font-size: 12px; }
.rp-box { border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--raised); overflow: hidden; }
.rp-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.rp-tools { display: flex; align-items: center; gap: 1px; padding: 3px 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rp-tools button { min-width: 26px; height: 24px; padding: 0 6px; border: 0; border-radius: 5px; background: none; color: var(--muted); font-size: 12.5px; }
.rp-tools button:hover { background: var(--hover); color: var(--head); }
.rp-t-B { font-weight: 800; } .rp-t-I { font-style: italic; } .rp-t-U { text-decoration: underline; } .rp-t-S { text-decoration: line-through; }
.rp-t-code { font-family: ui-monospace, Consolas, monospace; }
.rp-sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 4px; }
.rp-count { margin-left: auto; color: var(--faint); font-size: 11.5px; }
.rp-count.bad { color: var(--red); }
.rp-box textarea { display: block; width: 100%; min-height: 38px; resize: none; overflow: hidden; border: 0; border-radius: 0; background: none;
                   box-shadow: none; padding: 8px 11px; color: var(--head); font: inherit; line-height: 1.45; }
.rp-box textarea:focus { outline: none; box-shadow: none; }
.rp-rm { margin-top: 26px; }
.rp-add { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0 4px; border-top: 1px solid var(--line); }
.rp-side { position: sticky; top: 16px; display: grid; gap: 6px; }
.rp-side-lbl { color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
/* the preview keeps Discord's own dark look in every theme */
.rp-pv { background: #313338; color: #dbdee1; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.rp-pv-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rp-pv-head b { color: #f2f3f5; }
.rp-pv-card { background: #2b2d31; border-left: 4px solid #2c2f33; border-radius: 8px; padding: 12px 14px; display: grid; gap: 4px; }
.rp-pv-card .md-h3 { color: #f2f3f5; font-size: 17px; margin: 0; }
.rp-pv-card .md-sub, .rp-pv-card .note { color: #949ba4; }
.rp-pv-card hr { border: 0; border-top: 1px solid #3f4147; margin: 8px 0; width: 100%; }
.rp-pv-role { margin-bottom: 10px; overflow-wrap: anywhere; }
.rp-pv-role b { color: #f2f3f5; }
.rp-pv-role .emoji, .rp-pv-btn .emoji, .rp-pv .rp-icon { width: 18px; height: 18px; vertical-align: -3px; object-fit: contain; }
.rp-pv-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.rp-pv-btn { display: inline-flex; align-items: center; gap: 6px; background: #4e5058; color: #fff; border-radius: 8px; padding: 5px 12px; font-weight: 500; }
@media (max-width: 1100px) {
  .rp-grid { grid-template-columns: minmax(0, 1fr); }
  .rp-side { position: static; }
}
@media (max-width: 640px) {
  .rp-entry { grid-template-columns: 24px 44px minmax(0, 1fr); }
  .rp-rm { grid-column: 3; margin-top: 0; justify-self: start; }
}

/* ── Messages (editor.js): list | look and wording | preview ── */
.ed-studio { display: grid; grid-template-columns: 200px minmax(0, 1fr) minmax(300px, 360px); gap: 16px; align-items: start; }
.ed-work { min-width: 0; display: grid; gap: 14px; }
.ed-work > div:empty { display: none; }
.ed-work .card { margin: 0; }
.ed-work .card h3 { margin: 0 0 2px; }
.ed-work .card > .note { margin: 0 0 12px; }
.ed-list { position: sticky; top: 14px; padding: 8px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; max-height: calc(100vh - 28px); overflow: hidden auto; }
.ed-list h6 { margin: 12px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.ed-li { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 0; padding: 7px 9px; border: 0; border-radius: 9px;
         background: none; color: var(--text); text-align: left; box-shadow: none; font-weight: 500; }
.ed-li:hover { background: var(--hover); color: var(--head); }
.ed-li.on { background: var(--soft); color: var(--head); }
.ed-li.all { font-weight: 650; }
.ed-li > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-li-tag { margin-left: auto; flex: none; font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 6px; background: var(--hover); color: var(--muted);
             max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-li-tag.own { background: var(--soft); color: var(--hi); }
.ed-pres { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
.ed-pres.own { margin: 14px 0 6px; }
.ed-pre { display: grid; gap: 4px; align-content: start; text-align: left; min-height: 0; padding: 9px; border-radius: 12px;
          background: var(--raised); border: 2px solid transparent; box-shadow: none; color: var(--text); }
.ed-pre:hover { border-color: var(--line-2); background: var(--raised); }
.ed-pre.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--raised)); }
.ed-pre .ed-mini { height: 46px; margin-bottom: 4px; }
.ed-pre b { color: var(--head); font-size: 13px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.ed-pre small { color: var(--muted); font-size: 12px; }
.ed-pre-note { margin: 10px 0 0 !important; }
.ed-opts { padding-top: 2px; }
.ed-opts .row:first-child { border-top: 0; }
.ed-based { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.ed-pill { background: var(--soft); color: var(--hi); border-radius: 999px; padding: 2px 10px; font-weight: 600; }
.linkish { background: none; border: 0; box-shadow: none; padding: 0; min-height: 0; color: var(--hi); font-weight: 600; font-size: 13px; }
.linkish:hover { background: none; text-decoration: underline; }
.ed-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ed-ov { display: flex; align-items: center; gap: 8px; min-height: 0; padding: 9px 11px; text-align: left; background: var(--raised);
         border: 1px solid var(--line); border-radius: 10px; box-shadow: none; color: var(--text); }
.ed-ov:hover { border-color: var(--line-2); background: var(--raised); }
.ed-ov > span { flex: 1; min-width: 0; display: grid; }
.ed-ov b { color: var(--head); font-size: 13.5px; font-weight: 600; }
.ed-ov small { color: var(--muted); font-size: 12px; }
.ed-ov .line-ic { width: 16px; height: 16px; color: var(--faint); }
.ed-insert { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.ed-insert .note { margin: 0; font-size: 12.5px; }
.ed-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.ed-fields .wide, .ed-field.wide { grid-column: 1 / -1; }
.ed-fields .ed-group { margin: 8px 0 -4px; }
.ed-field { min-width: 0; border-radius: 10px; transition: box-shadow var(--mid); }
.ed-field label { display: block; margin-bottom: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ed-field input { width: 100%; }
.ed-field textarea { width: 100%; min-height: 150px; resize: vertical; }
.ed-field-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.ed-field-foot .note { margin: 0; font-size: 12px; flex: 1; min-width: 200px; }
.ed-field-foot .count { font-size: 12px; color: var(--muted); }
.ed-field.flash { box-shadow: 0 0 0 3px var(--soft), 0 0 0 1px var(--hi); }
.ed-more { margin-top: 12px; }
.ed-side2 { position: sticky; top: 14px; min-width: 0; }
.ed-prev-card { margin: 0; display: grid; gap: 12px; }
.ed-prev-card .note { margin: 0; }
.ed-prev-card .ed-preview { cursor: pointer; }
@media (max-width: 1200px) {
  .ed-studio { grid-template-columns: 200px minmax(0, 1fr); }
  .ed-side2 { grid-column: 1 / -1; position: static; }

}
@media (max-width: 720px) {
  .ed-studio { grid-template-columns: minmax(0, 1fr); }
  .ed-list { position: static; display: flex; gap: 4px; overflow-x: auto; max-height: none; }
  .ed-list h6, .ed-li-tag { display: none; }
  .ed-li { width: auto; flex: none; }
  .ed-pres, .ed-pres.own { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-fields, .ed-overview { grid-template-columns: minmax(0, 1fr); }
}
