  /* Onest (SIL OFL 1.1, fonts/OFL.txt), self-hosted: Cyrillic and Latin, one variable file each. */
  @font-face { font-family:"Onest"; font-style:normal; font-weight:100 900; font-display:swap;
    src:url(/web/onest-cyrillic.woff2) format("woff2"); unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
  @font-face { font-family:"Onest"; font-style:normal; font-weight:100 900; font-display:swap;
    src:url(/web/onest-latin.woff2) format("woff2");
    unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

  /* Tokens. Dark by default; light when chosen (data-theme, set before the first paint by the script
     in <head>) or, with "Как в системе", when the OS is light. The two light blocks must stay equal.
     Ladder: rail < side < ground (--bg) < card. */
  :root { color-scheme:dark;
    --rail:#0e1013; --side:#15181c; --bg:#1b1e23; --card:#23272e; --card-hover:#292e36; --card-line:#2d323a;
    --hover:#262b32; --chip:#353c46; --active:#2f353e; --line:#2a2f37; --line-strong:#3a414b; --input:#101216; --input-line:#2a2f37;
    --btn:#2c323a; --btn-hover:#363d47; --menu:#101216; --me:#111317; --msghover:#1f2228; --quote:#4a525d;
    --text:#d5dbe2; --muted:#959eaa; --label:#b3bcc7; --head:#f2f5f8;
    --accent:#2fd3b0; --accent-hover:#5ce0c3; --on-accent:#04221c; --on-hue:#ffffff; --accent-soft:rgba(47,211,176,.14); --accent-text:#3ddcba; --mention:#86f2da;
    --danger:#f87e82; --danger-strong:#c9363b; --on-danger:#ffffff; --danger-soft:rgba(248,126,130,.13);
    --warn:#f2b63c; --warn-text:#f5c45f; --warn-soft:rgba(242,182,60,.14); --on-warn:#1d1500;
    --ok:#3ccf7e; --ok-text:#56da90; --offline:#737c88;
    --code:#2b3038; --pre:#0d1014; --pre-line:#262b32; --pre-text:#d5dbe2;
    --shadow:rgba(0,0,0,.5); --shadow-soft:rgba(0,0,0,.28); --backdrop:rgba(4,6,8,.68); --toast:#0a0c0f; --toast-text:#eef2f5;
    --scroll:#343a43; --scroll-hover:#47505b; --selection:rgba(47,211,176,.3); --focus:#2fd3b0;
    --chev:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23959eaa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
  :root[data-theme=light] { color-scheme:light;
    --rail:#dde2e8; --side:#ebeef2; --bg:#f9fafb; --card:#ffffff; --card-hover:#fcfcfd; --card-line:#d9dfe6;
    --hover:#e1e5ea; --chip:#e1e5ea; --active:#d4dae2; --line:#dce1e7; --line-strong:#c5ccd5; --input:#ffffff; --input-line:#cdd4dc;
    --btn:#e2e6eb; --btn-hover:#d5dbe2; --menu:#ffffff; --me:#e2e6eb; --msghover:#eff1f4; --quote:#c3cad3;
    --text:#1d2329; --muted:#59626f; --label:#3e4651; --head:#0b0f13;
    --accent:#0e7c6b; --accent-hover:#0a6a5b; --on-accent:#ffffff; --on-hue:#ffffff; --accent-soft:rgba(14,124,107,.11); --accent-text:#0b6e5f; --mention:#06594c;
    --danger:#c42b31; --danger-strong:#c42b31; --on-danger:#ffffff; --danger-soft:rgba(196,43,49,.1);
    --warn:#d99a12; --warn-text:#875800; --warn-soft:rgba(217,154,18,.16); --on-warn:#1d1500;
    --ok:#1f9d57; --ok-text:#16733d; --offline:#8a929c;
    --code:#e7ebef; --pre:#14181d; --pre-line:#14181d; --pre-text:#d5dbe2;
    --shadow:rgba(16,24,40,.18); --shadow-soft:rgba(16,24,40,.08); --backdrop:rgba(15,20,26,.45); --toast:#1b2026; --toast-text:#f2f5f8;
    --scroll:#c3cad3; --scroll-hover:#a7b0bb; --selection:rgba(14,124,107,.2); --focus:#0e7c6b;
    --chev:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2359626f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
  @media (prefers-color-scheme: light) { :root:not([data-theme]) { color-scheme:light;
    --rail:#dde2e8; --side:#ebeef2; --bg:#f9fafb; --card:#ffffff; --card-hover:#fcfcfd; --card-line:#d9dfe6;
    --hover:#e1e5ea; --chip:#e1e5ea; --active:#d4dae2; --line:#dce1e7; --line-strong:#c5ccd5; --input:#ffffff; --input-line:#cdd4dc;
    --btn:#e2e6eb; --btn-hover:#d5dbe2; --menu:#ffffff; --me:#e2e6eb; --msghover:#eff1f4; --quote:#c3cad3;
    --text:#1d2329; --muted:#59626f; --label:#3e4651; --head:#0b0f13;
    --accent:#0e7c6b; --accent-hover:#0a6a5b; --on-accent:#ffffff; --on-hue:#ffffff; --accent-soft:rgba(14,124,107,.11); --accent-text:#0b6e5f; --mention:#06594c;
    --danger:#c42b31; --danger-strong:#c42b31; --on-danger:#ffffff; --danger-soft:rgba(196,43,49,.1);
    --warn:#d99a12; --warn-text:#875800; --warn-soft:rgba(217,154,18,.16); --on-warn:#1d1500;
    --ok:#1f9d57; --ok-text:#16733d; --offline:#8a929c;
    --code:#e7ebef; --pre:#14181d; --pre-line:#14181d; --pre-text:#d5dbe2;
    --shadow:rgba(16,24,40,.18); --shadow-soft:rgba(16,24,40,.08); --backdrop:rgba(15,20,26,.45); --toast:#1b2026; --toast-text:#f2f5f8;
    --scroll:#c3cad3; --scroll-hover:#a7b0bb; --selection:rgba(14,124,107,.2); --focus:#0e7c6b;
    --chev:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2359626f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); } }
  :root { --font:"Onest", system-ui, -apple-system, "Segoe UI", sans-serif; --mono:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --ease:cubic-bezier(.16, 1, .3, 1); }

  /* base and browser surfaces */
  * { box-sizing:border-box; }
  [hidden] { display:none !important; }
  html { scrollbar-color:var(--scroll) transparent; }
  * { scrollbar-width:thin; scrollbar-color:var(--scroll) transparent; }
  ::-webkit-scrollbar { width:10px; height:10px; }
  ::-webkit-scrollbar-thumb { background:var(--scroll); border-radius:8px; border:2px solid transparent; background-clip:padding-box; }
  ::-webkit-scrollbar-thumb:hover { background-color:var(--scroll-hover); }
  ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background:transparent; }
  ::selection { background:var(--selection); color:inherit; }
  body { margin:0; height:100vh; display:flex; overflow:hidden; font:400 14px/1.43 var(--font); background:var(--bg); color:var(--text);
         -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility; }
  input, textarea, select, button { font:inherit; color:inherit; }
  input, textarea { caret-color:var(--accent); }
  a { color:var(--accent-text); text-underline-offset:2px; text-decoration-thickness:1px; }
  :focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
  .ic { width:16px; height:16px; flex:none; vertical-align:-3px; fill:currentColor; stroke:none; }
  .ic.fill { fill:currentColor; }
  .ic.s12 { width:12px; height:12px; vertical-align:-1px; } .ic.s14 { width:14px; height:14px; vertical-align:-2px; }
  .ic.s18 { width:18px; height:18px; vertical-align:-4px; } .ic.s20 { width:20px; height:20px; }
  .badge, .count, time, .due, .check, .meta, .react, .tile b, .thread-foot, #timer, .g-day, table.report td, .fields, .k, .typing { font-variant-numeric:tabular-nums; }

  /* buttons: secondary (default), primary, danger, ghost, link */
  button { cursor:pointer; border:0; border-radius:4px; background:var(--btn); color:var(--text); padding:0 12px; min-height:32px;
           display:inline-flex; align-items:center; justify-content:center; gap:6px; font-weight:500; line-height:1.2;
           transition:background-color .12s, color .12s, box-shadow .12s; }
  button:hover { background:var(--btn-hover); color:var(--head); }
  button.primary { background:var(--accent); color:var(--on-accent); font-weight:600; }
  button.primary:hover { background:var(--accent-hover); color:var(--on-accent); }
  button.danger { background:var(--danger-strong); color:var(--on-danger); font-weight:600; }
  button.danger:hover { background:var(--danger-strong); color:var(--on-danger); box-shadow:inset 0 0 0 100px rgba(0,0,0,.12); }
  button.ghost { background:none; color:var(--muted); padding:0 8px; }
  button.ghost:hover { color:var(--head); background:var(--hover); }
  button.ghost[aria-pressed=true] { color:var(--head); }
  button:disabled, button:disabled:hover { opacity:.45; cursor:not-allowed; box-shadow:none; }
  button.link { background:none; color:var(--accent-text); padding:0; min-height:0; font-weight:500; text-align:left; display:inline; }
  button.link:hover { background:none; text-decoration:underline; text-underline-offset:2px; }
  button.icon { width:32px; padding:0; }

  /* fields */
  textarea, input:not([type=checkbox]):not([type=radio]), select { color:var(--text); background:var(--input); border:1px solid var(--input-line);
    border-radius:4px; padding:8px 10px; width:100%; min-height:36px; transition:border-color .12s, box-shadow .12s; }
  textarea::placeholder, input::placeholder { color:var(--muted); opacity:1; }
  textarea:focus, input:not([type=checkbox]):not([type=radio]):focus, select:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-soft); }
  textarea { resize:vertical; line-height:1.45; }
  select { appearance:none; background-image:var(--chev); background-repeat:no-repeat; background-position:right 8px center; background-size:16px; padding-right:30px; cursor:pointer; }
  select[size] { background-image:none; padding-right:10px; }
  input[type=checkbox], input[type=radio] { accent-color:var(--accent); width:16px; height:16px; margin:0; cursor:pointer; flex:none; }
  input[type=date], input[type=datetime-local] { color-scheme:inherit; }
  textarea:disabled { opacity:.6; cursor:not-allowed; }

  /* server rail */
  #rail { width:72px; flex:none; background:var(--rail); padding:12px 0 calc(var(--me-h, 56px) + 28px); display:flex; flex-direction:column; align-items:center; gap:8px; overflow-y:auto; scrollbar-width:none; }
  #rail::-webkit-scrollbar { display:none; }
  .rail-sep { width:32px; height:2px; flex:none; border-radius:1px; background:var(--line-strong); margin:0 0 0; }
  .srv { position:relative; width:48px; height:48px; flex:none; border-radius:50%; padding:0; font-size:17px; font-weight:600; background:var(--card); color:var(--head);
         transition:border-radius .2s var(--ease), background-color .15s, color .15s; }
  .srv .ic { width:22px; height:22px; }
  .srv:hover, .srv.on { border-radius:16px; background:var(--accent); color:var(--on-accent); }
  .srv.add { color:var(--accent-text); background:var(--card); }
  .srv.add:hover { background:var(--accent); color:var(--on-accent); }
  /* the pill on the rail's edge: unread (dot), hover (short), open (tall) */
  .srv::before { content:''; position:absolute; left:-12px; top:50%; width:4px; height:0; margin-top:0; border-radius:0 4px 4px 0; background:var(--head);
                 transition:height .2s var(--ease), margin-top .2s var(--ease); }
  .srv.unread::before { height:8px; margin-top:-4px; }
  .srv:hover::before { height:20px; margin-top:-10px; }
  .srv.on::before { height:40px; margin-top:-20px; }
  .srv.add::before { display:none; }
  .srv .badge { position:absolute; right:-4px; bottom:-4px; box-shadow:0 0 0 3px var(--rail); }

  /* channel sidebar */
  #side { width:240px; flex:none; background:var(--side); display:flex; flex-direction:column; padding-bottom:calc(var(--me-h, 56px) + 16px); }
  #side > header .srv-name { flex:1; min-width:0; justify-content:flex-start; gap:6px; height:36px; min-height:36px; padding:0 8px; margin-left:-8px; background:none;
                             color:var(--head); font-size:15px; font-weight:600; border-radius:4px; text-align:left; }
  #side > header .srv-name:hover, #side > header .srv-name:focus-visible { background:var(--hover); }
  #side > header .srv-name .ic { color:var(--label); }
  #side > header .find { flex:1; justify-content:flex-start; height:30px; min-height:30px; margin-left:-6px; padding:0 8px; background:var(--rail); color:var(--muted);
                         font-size:13px; font-weight:500; border-radius:6px; text-align:left; }
  #side > header .find:hover { color:var(--text); background:var(--rail); }
  .chan.home-nav, .chan.dm { min-height:42px; gap:12px; padding:0 8px; }
  .chan.home-nav > .ic { width:20px; height:20px; margin:0 6px; }
  .chan.dm .grow { display:flex; flex-direction:column; line-height:1.25; }
  .chan.dm .dm-name { overflow:hidden; text-overflow:ellipsis; }
  .chan.dm .k { font-size:12px; overflow:hidden; text-overflow:ellipsis; }
  .chan.dm .k:empty { display:none; }
  #side > header { height:48px; flex:none; padding:0 8px 0 16px; display:flex; align-items:center; gap:4px; font-size:15px; font-weight:600; color:var(--head);
                   border-bottom:1px solid var(--line); box-shadow:0 1px 2px var(--shadow-soft); }
  #chans { flex:1; overflow-y:auto; padding:8px 8px 12px; }
  .cat { display:flex; align-items:center; gap:2px; margin:18px 0 4px; padding-left:4px; font-size:12px; font-weight:600; letter-spacing:.02em; text-transform:uppercase; color:var(--muted); }
  .cat:first-child { margin-top:4px; }
  .cat button.ghost { width:24px; min-height:24px; padding:0; }
  .cat .cat-name { flex:1; min-width:0; display:flex; justify-content:flex-start; gap:2px; text-align:left; background:none; color:inherit; font:inherit; letter-spacing:inherit;
                   text-transform:inherit; padding:0; min-height:24px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .cat .cat-name:hover { color:var(--text); background:none; }
  .cat-name > span { overflow:hidden; text-overflow:ellipsis; }
  .chan { position:relative; display:flex; align-items:center; justify-content:flex-start; gap:6px; width:100%; min-height:32px; text-align:left; background:none; color:var(--muted);
          padding:0 8px; margin:1px 0; font-size:15px; font-weight:500; }
  .chan > .ic { width:18px; height:18px; color:var(--muted); opacity:.9; }
  .chan:hover { background:var(--hover); color:var(--text); }
  .chan.on { background:var(--active); color:var(--head); }
  .chan.on > .ic { color:var(--head); opacity:1; }
  .chan.unread { color:var(--head); font-weight:600; }
  .chan.unread > .ic { color:var(--head); }
  .chan.unread::before { content:''; position:absolute; left:-8px; top:50%; width:4px; height:8px; margin-top:-4px; border-radius:0 4px 4px 0; background:var(--head); }
  .chan .badge { margin-left:auto; }
  .chan .ic.lock { width:12px; height:12px; margin-left:-4px; opacity:.8; }
  .chan .k { font-size:12px; font-weight:400; white-space:nowrap; }
  .row { display:flex; align-items:center; }
  .row > .chan { flex:1; min-width:0; }
  .grow { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .sep { height:1px; background:var(--line); margin:8px 4px; }
  .toggle { display:flex; gap:8px; align-items:center; font-size:12px; color:var(--muted); margin:18px 8px 4px; cursor:pointer; }
  button.gear { padding:0; width:24px; min-height:24px; height:24px; flex:none; color:var(--muted); visibility:hidden; }
  button.gear .ic { width:16px; height:16px; }
  button.gear:hover { color:var(--head); background:none; }
  button.gear[aria-pressed=true] { visibility:visible; color:var(--warn); }
  :hover > .gear, .gear:focus-visible, #board-name .gear, .col h2 .gear { visibility:visible; } /* column headers: always shown */
  @media (hover:none) { button.gear { visibility:visible; } }
  .row:has(> .chan.on) > .gear { visibility:visible; }

  /* user panel (floats across the rail and the sidebar, as in Discord), voice bar, stopwatch */
  #me { position:fixed; left:8px; bottom:8px; z-index:5; width:calc(72px + 240px - 16px); display:flex; flex-direction:column;
        background:var(--card); border:1px solid var(--card-line); border-radius:8px; box-shadow:0 8px 24px var(--shadow-soft); font-size:14px; }
  #me:empty { display:none; }
  .me-row { height:56px; display:flex; align-items:center; gap:2px; padding:0 6px 0 4px; }
  .me-who .in-voice { display:flex; align-items:center; gap:4px; color:var(--ok-text); }
  .me-who .in-voice .ic { flex:none; }
  /* «Голос подключён» on top of the user panel */
  .vconn { padding:8px 8px 10px; border-bottom:1px solid var(--line); }
  .vconn-top { display:flex; align-items:center; gap:2px; }
  .vconn-top button.ghost:not(.vwhere) { width:32px; height:32px; min-height:32px; padding:0; flex:none; color:var(--label); }
  .vconn-top button.ghost:hover { color:var(--head); }
  .vconn-top button.ghost[aria-pressed=false] { color:var(--danger); }
  .vconn-top .vwhere { flex:1; min-width:0; width:auto; height:auto; min-height:36px; padding:2px 4px; display:flex; flex-direction:column; align-items:flex-start; justify-content:center;
                       text-align:left; line-height:1.25; }
  .vconn-top .vwhere b { font-size:14px; font-weight:600; }
  .vconn-top .vwhere .k { font-size:12px; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .vconn-top .vwhere:hover .k { color:var(--text); text-decoration:underline; }
  .vconn-top button.vq.good, .vwhere b.good { color:var(--ok-text); } .vconn-top button.vq.fair, .vwhere b.fair { color:var(--warn); }
  .vconn-top button.vq.bad, .vwhere b.bad { color:var(--danger); } .vconn-top button.vq.wait, .vwhere b.wait { color:var(--muted); }
  .vconn-top button.hangup:hover { background:var(--danger-strong); color:var(--on-danger); }
  .vbigs { display:flex; gap:8px; margin-top:8px; }
  .vconn-top span.vq { width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center; flex:none; color:var(--muted); }
  .vconn-top div.vwhere { cursor:default; } .vconn-top div.vwhere b { color:var(--head); }
  .vback { width:100%; margin-top:8px; min-height:32px; }
  .vblocked { width:100%; margin-top:8px; min-height:32px; font-size:12px; justify-content:flex-start; text-align:left; background:var(--warn-soft, var(--hover)); color:var(--head); }
  .vbig { flex:1; height:32px; min-height:32px; padding:0; border-radius:6px; background:var(--hover); color:var(--head); }
  .vbig:hover { background:var(--line-strong); }
  .vbig.on { background:var(--accent); color:var(--on-accent); }
  .vbig:disabled { opacity:.5; }
  .srv-voice { position:absolute; right:-4px; top:-4px; width:20px; height:20px; border-radius:50%; display:flex; align-items:center; justify-content:center;
               background:var(--ok); color:var(--on-accent); box-shadow:0 0 0 3px var(--rail); }
  .srv .srv-voice .ic { width:12px; height:12px; }
  .me-who { flex:1; min-width:0; justify-content:flex-start; gap:8px; height:44px; min-height:44px; padding:0 6px 0 4px; background:none; border-radius:6px; text-align:left; }
  .me-who:hover { background:var(--hover); }
  .me-who .who { display:flex; flex-direction:column; min-width:0; line-height:1.25; }
  .me-who .who b { color:var(--head); font-size:14px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .me-who .who .k { font-size:12px; font-weight:400; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .vctl { display:flex; align-items:center; border-radius:6px; flex:none; }
  .vctl:hover { background:var(--hover); }
  .vctl button.ghost, .me-gear { width:32px; height:32px; min-height:32px; padding:0; color:var(--label); }
  .vctl button.ghost:hover, .me-gear:hover { background:none; color:var(--head); }
  .me-gear { flex:none; border-radius:6px; } .me-gear:hover { background:var(--hover); }
  .vctl button.caret { width:18px; margin-left:-4px; }
  .vctl.off { background:var(--danger-soft); } .vctl.off button.ghost { color:var(--danger); }
  #me .dot::after { box-shadow:0 0 0 3px var(--card); }
  .ava.m32 { width:32px; height:32px; font-size:14px; }
  #timer { display:flex; align-items:center; padding:6px 8px; background:var(--me); font-size:13px; border-bottom:1px solid var(--line); }
  #timer[hidden] { display:none; }
  #timer .grow { flex:1; min-width:0; justify-content:flex-start; text-align:left; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; color:var(--ok-text); }
  #timer .grow > span:last-child { overflow:hidden; text-overflow:ellipsis; }

  /* login / register: a solid ground, one card */
  #auth { position:fixed; inset:0; z-index:30; display:grid; place-items:center; padding:16px; background:var(--rail); }
  #auth-form { width:100%; max-width:420px; background:var(--bg); border:1px solid var(--line); border-radius:8px; padding:32px; display:flex; flex-direction:column; gap:16px;
               box-shadow:0 12px 32px var(--shadow); }
  #auth-form h2 { margin:0 0 4px; text-align:center; color:var(--head); font-size:24px; font-weight:700; letter-spacing:-.01em; }
  #auth-form label { display:flex; flex-direction:column; gap:8px; font-size:12px; font-weight:600; letter-spacing:.02em; text-transform:uppercase; color:var(--label); }
  #auth-form input { text-transform:none; letter-spacing:0; font-weight:400; font-size:16px; min-height:44px; }
  #auth-form .primary { min-height:44px; font-size:15px; }
  #auth-error { color:var(--danger); font-size:14px; min-height:1em; }
  #auth-switch { align-self:flex-start; font-size:14px; }
  #auth-invite { text-align:center; color:var(--head); }

  /* main area */
  #main { flex:1; display:flex; flex-direction:column; min-width:0; }
  #main > header, #thread > header, #panel > header { height:48px; flex:none; padding:0 8px 0 16px; display:flex; align-items:center; gap:4px;
    border-bottom:1px solid var(--line); box-shadow:0 1px 2px var(--shadow-soft); position:relative; z-index:2; }
  header h1 { font-size:16px; font-weight:600; margin:0 4px 0 0; color:var(--head); flex:1; min-width:0; display:flex; align-items:center; gap:8px; white-space:nowrap; overflow:hidden; }
  header h1 > span { overflow:hidden; text-overflow:ellipsis; }
  header h1 > .ic { width:20px; height:20px; color:var(--muted); }
  #main > header button.ghost, #thread > header button.ghost, #panel > header button.ghost { min-width:32px; padding:0 6px; }
  #main > header .ic, #thread > header button .ic, #panel > header button .ic { width:20px; height:20px; }
  #main-tools, #thread-tools, #panel-tools { display:flex; align-items:center; gap:2px; }
  #add-col { color:var(--label); }
  .search { position:relative; display:flex; align-items:center; margin:0 4px; }
  .search > .ic { position:absolute; left:8px; width:14px; height:14px; color:var(--muted); pointer-events:none; }
  #search { width:180px; min-height:28px; padding:4px 8px 4px 28px; font-size:13px; background:var(--rail); border-color:transparent; transition:width .2s var(--ease), border-color .12s, box-shadow .12s; }
  #search:focus { width:260px; }
  #bell { position:relative; } #bell .badge { position:absolute; right:-2px; bottom:-2px; box-shadow:0 0 0 2px var(--bg); }

  /* kanban */
  #kanban { flex:1; display:flex; gap:12px; padding:16px; overflow:auto; align-items:flex-start; }
  .col { width:264px; flex:none; background:var(--side); border:1px solid var(--line); border-radius:8px; padding:8px; max-height:100%; display:flex; flex-direction:column; }
  .col h2 { font-size:12px; font-weight:600; letter-spacing:.03em; text-transform:uppercase; color:var(--label); margin:2px 2px 8px 6px; gap:6px; min-height:24px; }
  .col h2[draggable=true] { cursor:grab; }
  .col h2 .grow { white-space:normal; }
  .col h2 .count { color:var(--muted); font-weight:600; font-size:12px; min-width:20px; padding:0 6px; line-height:18px; border-radius:9px; background:var(--hover); text-align:center; }
  .col h2 .sums { text-transform:none; letter-spacing:0; font-weight:600; color:var(--head); margin-top:2px; }
  .cards { min-height:24px; display:flex; flex-direction:column; gap:8px; overflow-y:auto; margin:0 -4px; padding:2px 4px; }
  .col > .row { margin-top:6px; gap:2px; }
  .col > .row button.ghost { justify-content:flex-start; color:var(--muted); }
  .col > .row button.ghost:first-child { flex:1; }
  .card { position:relative; background:var(--card); border:1px solid var(--card-line); border-radius:8px; padding:10px 12px; cursor:pointer;
          box-shadow:0 1px 2px var(--shadow-soft); transition:background-color .12s, border-color .12s, box-shadow .15s; }
  .card:hover { background:var(--card-hover); border-color:var(--line-strong); }
  .card.hued { background:color-mix(in oklab, var(--hue) 9%, var(--card)); border-color:color-mix(in oklab, var(--hue) 30%, var(--card-line)); }
  .card.hued:hover { background:color-mix(in oklab, var(--hue) 13%, var(--card)); }
  .card.on { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent), 0 4px 12px var(--shadow-soft); }
  .card .title { font-weight:500; color:var(--head); overflow-wrap:anywhere; text-wrap:pretty; }
  .card .hue-dot { position:absolute; top:12px; right:12px; width:8px; height:8px; border-radius:50%; background:var(--hue); }
  .card.hued > .chips, .card.hued > .title:nth-child(2) { padding-right:14px; }
  .card > .chips { margin-bottom:8px; }
  .amount { font-size:13px; font-weight:600; color:var(--head); margin-top:4px; }
  .badges { display:flex; flex-wrap:nowrap; align-items:center; gap:5px; margin-top:8px; font-size:12px; color:var(--muted); min-width:0; }
  .badges > span { display:inline-flex; align-items:center; gap:4px; flex:none; }
  .badges > .time { flex:0 1 auto; min-width:0; }
  .badges > .time.over { color:var(--danger); }
  .badges .time .t { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
  .badges .avas { flex:none; }
  .card .nowrap { white-space:nowrap; }
  .card .desc-mark { display:inline-flex; margin-left:6px; color:var(--muted); vertical-align:-1px; }
  .due { display:inline-flex; align-items:center; gap:4px; padding:1px 6px; border-radius:4px; background:var(--chip); color:var(--label); white-space:nowrap; font-size:12px; font-weight:500; }
  .due.late { background:var(--danger-soft); color:var(--danger); } .due.soon { background:var(--warn-soft); color:var(--warn-text); }
  .check { display:inline-flex; align-items:center; gap:4px; }
  .check.all { color:var(--ok-text); }
  .avas { display:flex; margin-left:auto; padding-left:4px; } .avas .ava { margin-left:-4px; box-shadow:0 0 0 2px var(--card); }
  /* the thread under a card: how many messages, who wrote last, when; unread in the accent */
  .thread-foot { display:flex; align-items:center; gap:6px; margin-top:10px; padding-top:8px; border-top:1px solid var(--line); font-size:12px; color:var(--muted); }
  .card.hued .thread-foot { border-top-color:color-mix(in oklab, var(--hue) 22%, var(--line)); }
  .thread-foot .n { font-weight:600; color:var(--label); }
  .thread-foot .new { display:inline-flex; align-items:center; gap:4px; color:var(--accent-text); font-weight:600; }
  .thread-foot .new::before { content:''; width:6px; height:6px; border-radius:50%; background:var(--accent); }
  .thread-foot .last { margin-left:auto; display:inline-flex; align-items:center; gap:6px; min-width:0; }
  .thread-foot .last .ava { width:16px; height:16px; font-size:9px; }
  .thread-foot .last time { white-space:nowrap; }
  .chips { display:flex; flex-wrap:wrap; gap:4px; }
  .label { display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:500; padding:0 8px 0 6px; line-height:20px; border-radius:10px;
           background:var(--hover); color:var(--text); white-space:nowrap; }
  .label::before { content:''; width:8px; height:8px; border-radius:50%; background:var(--c, var(--muted)); flex:none; }
  .card .label { background:color-mix(in oklab, var(--c) 16%, var(--card)); }
  .ava { width:40px; height:40px; flex:none; border-radius:50%; display:inline-grid; place-items:center; font-weight:600; font-size:16px; color:#fff; }
  .ava.mini { width:20px; height:20px; font-size:11px; }
  .ava.big { width:64px; height:64px; font-size:28px; }
  img.ava { object-fit:cover; background:var(--card); }
  .person { display:inline-flex; align-items:center; gap:6px; }
  .done-title, .card .title.done-title { text-decoration:line-through; color:var(--muted); }

  /* drag and drop */
  .card.dragging, .col.dragging { opacity:.4; }
  .drop-mark { flex:none; border:2px dashed color-mix(in oklab, var(--accent) 65%, transparent); border-radius:8px; background:var(--accent-soft); }
  .col.drop-target { box-shadow:inset 0 0 0 2px var(--accent); }
  .col-drop-mark { flex:none; border:2px dashed color-mix(in oklab, var(--accent) 65%, transparent); border-radius:8px; background:var(--accent-soft); }

  /* chats */
  .chat { flex:1; display:flex; flex-direction:column; min-height:0; }
  .scroll { flex:1; overflow-y:auto; padding:8px 0 16px; }
  .msg { position:relative; display:flex; gap:16px; padding:2px 16px; } .msg:hover { background:var(--msghover); }
  .msg.first { margin-top:16px; }
  .msg:not(.first) > .ava { visibility:hidden; height:0; }
  .msg .body { min-width:0; flex:1; }
  .msg .who { font-weight:600; color:var(--head); font-size:15px; }
  .msg time { color:var(--muted); font-size:12px; margin-left:8px; }
  .msg .md { font-size:15px; line-height:1.47; }
  .msg.flash { background:var(--accent-soft) !important; }
  .msg.mentioned { background:color-mix(in oklab, var(--accent) 7%, var(--bg)); box-shadow:inset 2px 0 0 var(--accent); }
  .msg.mentioned:hover { background:color-mix(in oklab, var(--accent) 11%, var(--bg)); }
  .empty { color:var(--muted); padding:16px; }
  #voice > .empty { padding:16px 0; }
  .hint { color:var(--muted); font-size:12px; margin-top:4px; }
  .tools { position:absolute; right:16px; top:-16px; z-index:3; display:flex; gap:0; padding:2px; background:var(--card); border:1px solid var(--line); border-radius:8px;
           box-shadow:0 4px 12px var(--shadow-soft); opacity:0; pointer-events:none; transition:opacity .1s; }
  .msg:hover .tools, .msg:focus-within .tools { opacity:1; pointer-events:auto; }
  .tools button { width:32px; min-height:30px; padding:0; }
  .tools .ic { width:18px; height:18px; }
  .reply { display:flex; align-items:center; justify-content:flex-start; gap:4px; max-width:100%; min-height:0; background:none; padding:0; margin:2px 0; text-align:left; font-size:13px; font-weight:400;
           color:var(--muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
  .reply b { color:var(--label); font-weight:600; }
  .reply:hover { background:none; color:var(--head); }
  .meta { display:flex; align-items:center; gap:8px; font-size:11px; color:var(--muted); margin-top:2px; }
  .meta > span { display:inline-flex; align-items:center; gap:3px; }
  .reacts { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; }
  .react { min-height:26px; padding:0 8px; border-radius:8px; background:var(--card); border:1px solid var(--line); font-size:14px; font-weight:500; color:var(--label); }
  .react:hover { border-color:var(--line-strong); }
  .react.mine { background:var(--accent-soft); border-color:var(--accent); color:var(--head); }
  .msg .edit { resize:none; display:block; }
  .mention { background:var(--accent-soft); color:var(--mention); border-radius:4px; padding:0 2px; font-weight:500; }
  .bot { background:var(--accent); color:var(--on-accent); border-radius:3px; font-size:10px; font-weight:700; letter-spacing:.02em; padding:1px 4px; margin:0 6px; vertical-align:2px; }
  .newline { display:flex; align-items:center; gap:8px; margin:12px 16px 4px; color:var(--accent-text); font-size:11px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
  .newline::before { content:''; flex:1; border-top:1px solid var(--accent); }
  .thread-chip { display:flex; align-items:center; justify-content:flex-start; gap:6px; margin-top:6px; padding:0 10px; min-height:32px; font-size:13px; font-weight:400; background:var(--card);
                 border:1px solid var(--line); color:var(--muted); text-align:left; max-width:min(100%, 520px); border-radius:8px; }
  .thread-chip > span { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
  .thread-chip b { color:var(--head); font-weight:600; }
  .thread-chip .unread-dot { width:6px; height:6px; border-radius:50%; background:var(--accent); flex:none; }
  .sys { display:flex; gap:16px; align-items:baseline; padding:2px 16px; font-size:13px; color:var(--muted); }
  .sys > :first-child { width:40px; flex:none; text-align:center; }
  .sys > :first-child .ic { vertical-align:-3px; }
  .sys > span:nth-child(2) { flex:1; min-width:0; overflow-wrap:anywhere; }
  .sys b { color:var(--text); font-weight:600; }
  .sys time { font-size:11px; white-space:nowrap; }
  .fwd { border-left:2px solid var(--quote); padding:2px 0 2px 10px; margin:4px 0; }
  .fwd .md { margin:2px 0; }
  .fwd > .k:first-child { display:flex; align-items:center; gap:4px; }

  /* composer: one box with the attach, emoji, poll and send buttons */
  .composer { position:relative; padding:0 16px 4px; }
  .composer .attach { background:var(--input); border:1px solid var(--input-line); border-radius:8px; padding:4px; gap:2px; transition:border-color .12s, box-shadow .12s; }
  .composer .attach:focus-within { border-color:color-mix(in oklab, var(--accent) 60%, var(--input-line)); }
  .composer .attach > textarea { resize:none; max-height:40vh; display:block; background:none; border:0; box-shadow:none; padding:6px 4px; min-height:36px; font-size:15px; }
  .composer .attach > textarea::placeholder { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } /* a wrapped one would scroll */
  .composer .attach > button { width:36px; min-height:36px; padding:0; }
  .composer .attach > button .ic { width:20px; height:20px; }
  .composer .attach > button.send { color:var(--accent-text); }
  .composer .attach > button.send:hover { background:var(--accent); color:var(--on-accent); }
  .composer .attach > button.send:disabled { color:var(--muted); }
  .replybar { display:flex; align-items:center; gap:8px; background:var(--side); border:1px solid var(--input-line); border-bottom:0; border-radius:8px 8px 0 0; padding:2px 4px 2px 12px; font-size:13px; color:var(--muted); }
  .replybar b { color:var(--head); }
  .replybar:not([hidden]) + .attach { border-top-left-radius:0; border-top-right-radius:0; }
  .ac { position:absolute; left:16px; right:16px; bottom:100%; z-index:5; display:flex; flex-direction:column; background:var(--menu); border:1px solid var(--line); border-radius:8px; padding:6px;
        box-shadow:0 8px 24px var(--shadow); }
  .ac button { background:none; justify-content:flex-start; text-align:left; padding:0 8px; font-weight:500; }
  .ac button.on { background:var(--accent-soft); color:var(--head); }
  .typing { height:20px; padding-top:2px; font-size:12px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .attach { display:flex; align-items:flex-end; gap:4px; }
  .attach > textarea { flex:1; min-width:0; }
  .attach > button { padding:0 8px; }
  .msg .md img { max-height:300px; border-radius:8px; }

  /* markdown */
  .md { word-wrap:break-word; }
  .md > :first-child { margin-top:0; } .md > :last-child { margin-bottom:0; }
  .md p { margin:0 0 6px; }
  .md h1, .md h2, .md h3 { color:var(--head); margin:14px 0 6px; line-height:1.25; font-weight:700; letter-spacing:-.005em; }
  .md h1 { font-size:22px; } .md h2 { font-size:19px; } .md h3 { font-size:16px; }
  .md a { color:var(--accent-text); }
  .md code { font-family:var(--mono); font-size:85%; background:var(--code); color:var(--head); padding:2px 4px; border-radius:4px; }
  .md pre { background:var(--pre); color:var(--pre-text); border:1px solid var(--pre-line); border-radius:8px; padding:0; margin:6px 0; overflow-x:auto; }
  .md pre code { display:block; padding:10px 12px; background:none; color:inherit; font-size:13px; line-height:1.5; }
  .md blockquote { margin:4px 0; padding-left:12px; border-left:2px solid var(--quote); color:var(--label); }
  .md ul, .md ol { margin:4px 0; padding-left:24px; }
  .md table { display:block; max-width:100%; overflow-x:auto; border-collapse:collapse; margin:6px 0; font-variant-numeric:tabular-nums; } /* a wide table scrolls, not the message */
  .md th { background:var(--side); color:var(--head); font-weight:600; } .md th, .md td { border:1px solid var(--line-strong); padding:4px 8px; }
  .md img { max-width:100%; }
  .md hr { border:0; border-top:1px solid var(--line); }
  .md li:has(> input[type=checkbox]) { list-style:none; margin-left:-20px; }
  .md input[type=checkbox] { margin:0 6px 0 0; vertical-align:middle; }
  mark { background:var(--warn-soft); color:var(--head); border-radius:2px; padding:0 1px; box-shadow:inset 0 -2px 0 var(--warn); }

  /* task / thread panel */
  #thread { width:440px; flex:none; background:var(--bg); border-left:1px solid var(--line); display:flex; flex-direction:column; }
  #thread[hidden] { display:none; }
  /* the open card and its panel are one thread: the accent marks both */
  #thread.task > header { box-shadow:inset 0 -2px 0 var(--accent), 0 1px 2px var(--shadow-soft); }
  #thread-title > .ic { color:var(--accent-text); }
  #thread-title .hue-dot { width:10px; height:10px; border-radius:50%; background:var(--hue); flex:none; }
  #thread-title.done-title > span { text-decoration:line-through; color:var(--muted); }
  #thread-title.done-title { text-decoration:none; }
  #card-info { padding:16px; border-bottom:1px solid var(--line); }
  .sys.fold .link { font-size:13px; color:var(--muted); font-weight:500; } .sys.fold .link:hover { color:var(--head); }
  #card-info > .msg { padding:0; margin-top:6px; } #card-info > .msg .tools { right:0; }
  #card-info > .k:first-child { margin-bottom:4px; }
  .fields { display:grid; grid-template-columns:110px 1fr; gap:8px 12px; align-items:center; font-size:13px; margin-bottom:16px; }
  .fields > .k { color:var(--muted); }
  .ava.neutral { background:var(--btn); color:var(--muted); }

  /* the open task (#thread.task): title, property cells, description, checklist, then its chat; the narrow panel or the wide sheet.
     Every property is edited in place (a cell opens its .popover); there is no separate edit form. */
  #thread.task { --pad:16px; }
  #thread.task #card-info { padding:0; border-bottom:0; }
  #thread.task #card-info > .note { margin:12px var(--pad) 0; }
  .crumb { display:flex; align-items:center; gap:6px; min-width:0; overflow:hidden; }
  .crumb > span { overflow:hidden; text-overflow:ellipsis; }
  .crumb .c1 { color:var(--muted); font-weight:500; flex:none; max-width:45%; }
  .crumb > .ic { color:var(--muted); flex:none; }
  .tp-top { padding:16px var(--pad) 0; }
  .tp-top .meta { margin:4px 0 0 32px; font-size:12px; color:var(--muted); }
  .title-row { display:flex; align-items:flex-start; gap:10px; }
  .ttl { flex:1; min-width:0; margin:0; font-size:20px; font-weight:700; line-height:1.25; letter-spacing:-.01em; color:var(--head); text-wrap:balance; overflow-wrap:anywhere; }
  .ttl-btn { display:inline; min-height:0; padding:0; background:none; color:inherit; font:inherit; letter-spacing:inherit; text-align:left; cursor:text; }
  .ttl-btn:hover { background:none; color:inherit; text-decoration:underline dotted var(--line-strong); text-underline-offset:5px; }
  input.ttl-in { flex:1; min-width:0; min-height:32px; padding:2px 8px; font-size:20px; font-weight:700; letter-spacing:-.01em; color:var(--head); }
  .chk { flex:none; width:22px; height:22px; min-height:22px; margin-top:1px; padding:0; border-radius:50%; background:none; border:2px solid var(--line-strong); color:transparent; }
  .chk .ic { width:14px; height:14px; }
  .chk:hover:not(:disabled) { background:none; border-color:var(--ok); color:var(--ok); }
  .chk.on, .chk.on:hover:not(:disabled) { background:var(--ok); border-color:var(--ok); color:var(--bg); }
  .chk:disabled { opacity:1; cursor:default; } /* read-only: still shows the state */
  .blk { display:flex; align-items:center; gap:8px; margin-top:12px; padding:6px 10px; border-radius:4px; background:var(--warn-soft); color:var(--warn-text); font-size:13px; }
  .blk .link { color:inherit; font-weight:600; text-decoration:underline; text-underline-offset:2px; }
  /* property cells: hairlines between them (each draws its top and left edge; the outer ones are clipped) */
  .strip { display:grid; grid-template-columns:1fr 1fr; margin-top:16px; overflow:hidden; background:var(--side); border-block:1px solid var(--line); }
  .sc { position:relative; display:flex; flex-direction:column; gap:4px; min-width:0; margin:-1px 0 0 -1px; padding:8px 16px 10px; border-top:1px solid var(--line); border-left:1px solid var(--line);
        transition:background-color .12s; }
  .sc.w2 { grid-column:span 2; }
  .sc.can:hover, .sc.can:focus-within { background:var(--hover); }
  .sc-hit { position:absolute; inset:0; width:auto; min-height:0; padding:0; border-radius:0; background:none; }
  .sc-hit:hover { background:none; }
  .sc-hit:focus-visible { outline-offset:-2px; }
  .sc .lb { font-size:12px; font-weight:600; letter-spacing:.03em; text-transform:uppercase; color:var(--muted); }
  .sc .vl { display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; min-width:0; min-height:24px; }
  .sc .vl :is(button, a) { position:relative; z-index:1; } /* above the cell's own button */
  .sc .over { color:var(--danger); }
  .sc .hue-dot { width:12px; height:12px; flex:none; border-radius:50%; background:var(--hue); }
  .sc .hue-dot.none { background:none; box-shadow:inset 0 0 0 1px var(--line-strong); }
  .sel { display:inline-flex; align-items:center; gap:4px; height:24px; min-height:24px; padding:0 8px; border-radius:4px; background:var(--chip); color:var(--head); font-size:13px; font-weight:500; }
  .sel > .ic { margin-right:-4px; }
  button.sel:hover { background:var(--btn-hover); color:var(--head); }
  .ic24 { width:24px; height:24px; min-height:24px; padding:0 !important; }
  .prog { display:block; height:4px; border-radius:2px; background:var(--hover); overflow:hidden; }
  .prog > i { display:block; height:100%; border-radius:2px; background:var(--ok); }
  .prog.time > i { background:var(--label); }
  .tp-body { padding:0 var(--pad); }
  .tp-desc { position:relative; margin-top:16px; }
  .md-big .md { font-size:15px; line-height:1.47; }
  .tp-desc .pen { position:absolute; top:-6px; right:-6px; opacity:0; background:var(--bg); transition:opacity .12s; }
  .tp-desc:hover .pen, .tp-desc .pen:focus-visible { opacity:1; }
  @media (hover:none) { .tp-desc .pen { opacity:1; } }
  .tp-cl { margin-top:20px; }
  .tp-cl input:not([type=checkbox]) { margin-top:6px; }
  .cl-head { display:flex; align-items:center; gap:10px; margin-bottom:6px; }
  .cl-head b { color:var(--head); font-weight:600; }
  .cl-head .prog { flex:1; }
  .disc { margin:24px var(--pad) 0; padding-top:12px; border-top:1px solid var(--line); font-size:12px; font-weight:600; letter-spacing:.03em; text-transform:uppercase; color:var(--muted); }
  /* the description editor: one box, «Текст / Превью», its actions at the foot */
  .ed { margin-top:16px; background:var(--input); border:1px solid var(--accent); border-radius:8px; box-shadow:0 0 0 2px var(--accent-soft); overflow:hidden; }
  .ed-tabs { display:flex; align-items:center; gap:2px; padding:4px; border-bottom:1px solid var(--input-line); }
  .ed-tabs button { min-height:26px; padding:0 8px; font-size:13px; background:none; color:var(--muted); }
  .ed-tabs button[aria-pressed=true] { background:var(--hover); color:var(--head); }
  .ed-tabs .hint, .ed-foot .hint { margin:0 6px 0 auto; }
  .ed .attach { align-items:flex-start; padding:4px 4px 0; }
  .ed textarea { min-height:236px; padding:6px 8px; background:none; border:0; border-radius:0; box-shadow:none !important; font-family:var(--mono); font-size:13px; line-height:1.5; }
  .ed > .hint { margin:0 12px; }
  .ed-prev { min-height:236px; padding:10px 12px; }
  .ed-foot { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:8px; border-top:1px solid var(--input-line); }
  /* a property's window (people, labels, dates, time, links, colour) */
  .popover { position:fixed; z-index:40; width:min(320px, calc(100vw - 16px)); max-height:calc(100vh - 16px); overflow-y:auto; display:flex; flex-direction:column; gap:8px; padding:12px;
             background:var(--menu); border:1px solid var(--line); border-radius:8px; box-shadow:0 12px 32px var(--shadow); animation:pop .14s var(--ease); }
  .popover:has(.chip-input) { overflow:visible; } /* its suggestions drop below */
  .pop-t { font-size:12px; font-weight:600; letter-spacing:.03em; text-transform:uppercase; color:var(--label); }
  .pop-l { display:flex; flex-direction:column; gap:4px; min-width:0; font-size:12px; font-weight:600; color:var(--label); }
  .pop-row { gap:6px; flex-wrap:wrap; }
  .popover .row input { flex:1; min-width:0; }
  .popover .row > button { margin-left:6px; }
  .popover .two { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
  .popover .two input { min-width:0; padding:6px 8px; font-size:13px; }
  .popover .quick { display:flex; flex-wrap:wrap; gap:4px; }
  .popover .quick button { min-height:28px; padding:0 8px; font-size:12px; }
  .popover .hint:empty { display:none; }
  .popover .ci { margin:0 -4px; }
  .popover .pop-add { align-self:flex-start; }
  .popover .palette { gap:8px; }
  .pop-foot { display:flex; justify-content:flex-end; gap:8px; margin-top:4px; padding-top:8px; border-top:1px solid var(--line); }
  /* the preview of a task next to its card */
  #peek { position:fixed; z-index:20; width:min(384px, calc(100vw - 24px)); max-height:calc(100vh - 24px); overflow-y:auto; display:flex; flex-direction:column;
          background:var(--bg); border:1px solid var(--line); border-radius:8px; box-shadow:0 12px 32px var(--shadow); animation:pop .14s var(--ease); }
  .pk-head { display:flex; align-items:flex-start; gap:10px; padding:14px 8px 0 14px; }
  #peek .ttl { font-size:17px; padding-top:1px; }
  #peek .ttl-btn { cursor:pointer; }
  #peek .ttl-btn:hover { text-decoration:underline; text-decoration-color:currentColor; text-underline-offset:3px; }
  .pk-tools { display:flex; flex:none; gap:2px; margin-top:-2px; }
  .pk-tools button { width:28px; min-height:28px; padding:0; }
  #peek > .meta { padding:2px 14px 0 46px; font-size:12px; color:var(--muted); }
  .pk-props { padding:8px 8px 0; }
  .pk-row { display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; min-height:30px; padding:2px 6px; font-size:13px; }
  .pk-row > .ic:first-child { color:var(--muted); }
  .pk-row.warn { color:var(--warn-text); } .pk-row.warn > .ic { color:inherit; }
  .pk-row .prog { width:48px; }
  .pk-desc { margin:10px 14px 0; padding-top:10px; border-top:1px solid var(--line); }
  .pk-desc .md { max-height:6.4em; overflow:hidden; -webkit-mask-image:linear-gradient(#000 45%, transparent); mask-image:linear-gradient(#000 45%, transparent); }
  .pk-desc .link { margin-top:2px; font-size:13px; }
  .pk-cl { display:flex; align-items:center; gap:10px; margin:10px 14px 0; font-size:13px; }
  .pk-cl > .ic { color:var(--muted); }
  .pk-cl .prog { width:64px; flex:none; }
  .pk-cl .next { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #peek .last { display:block; margin:12px 14px 0; padding:10px 12px; min-height:0; text-align:left; background:var(--side); border:1px solid var(--line); border-radius:8px;
                font-size:13px; font-weight:400; color:var(--text); }
  #peek .last:hover { background:var(--side); border-color:var(--line-strong); color:var(--text); }
  #peek .last .wr { display:flex; align-items:center; gap:6px; margin-bottom:2px; }
  #peek .last b { color:var(--head); font-weight:600; }
  #peek .last time { margin:0; font-size:12px; color:var(--muted); }
  #peek .last .tx { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
  .pk-foot { display:flex; padding:12px 14px 14px; }
  .pk-foot .primary { flex:1; }
  /* wide: a sheet over the dimmed board, which keeps its width; narrow: the panel on the right (the board is in the sidebar) */
  @media (min-width:901px) {
    #thread.task { animation:panel-in .2s var(--ease); }
    #thread.task.wide { --pad:32px; position:fixed; z-index:20; top:12px; right:12px; bottom:12px; width:min(820px, calc(100vw - 340px)); border:1px solid var(--line); border-radius:8px;
                        overflow:hidden; box-shadow:0 24px 64px var(--shadow); }
    body.sheet #main { position:relative; }
    body.sheet #main::after { content:''; position:absolute; inset:0; z-index:15; background:var(--backdrop); animation:fade .2s var(--ease); }
    #thread.task.wide .tp-top { padding-top:24px; }
    #thread.task.wide .ttl, #thread.task.wide input.ttl-in { font-size:24px; }
    #thread.task.wide .strip { grid-template-columns:repeat(4, minmax(0, 1fr)); margin-top:20px; }
    #thread.task.wide .sc { padding:10px 16px 12px; }
    #thread.task.wide .tp-body { max-width:784px; }
    #thread.task.wide .tp-desc { margin-top:20px; }
    #thread.task.wide .msg, #thread.task.wide .sys { padding-left:var(--pad); padding-right:var(--pad); }
    #thread.task.wide .composer { padding:0 var(--pad) 8px; }
  }
  /* the board is in the sidebar: the narrow panel and small screens show only the column */
  #thread.task:not(.wide) .crumb .c1, #thread.task:not(.wide) .crumb .c1 + .ic { display:none; }
  @media (max-width:900px) { .wide-toggle, #thread.task .crumb .c1, #thread.task .crumb .c1 + .ic { display:none; } }
  @media (max-width:700px) { .chk { position:relative; } .chk::after { content:''; position:absolute; inset:-11px; } } /* a 44px touch target */
  @keyframes panel-in { from { opacity:0; transform:translateX(24px); } }
  @keyframes fade { from { opacity:0; } }
  .fields button.ghost { min-height:24px; font-size:12px; }
  .k { color:var(--muted); }
  .note { display:flex; align-items:center; gap:8px; background:var(--card); border:1px solid var(--line); border-radius:8px; padding:8px 12px; margin-bottom:12px; }
  .note > .ic { color:var(--muted); }
  .ci { display:flex; align-items:center; gap:8px; padding:2px 4px; border-radius:4px; min-height:28px; }
  .ci:hover { background:var(--hover); }
  .ci span { flex:1; min-width:0; overflow-wrap:anywhere; }
  .ci.done span { text-decoration:line-through; color:var(--muted); }
  .ci button { visibility:hidden; padding:0; width:24px; min-height:24px; background:none; color:var(--muted); }
  .ci:hover button, .ci button:focus-visible { visibility:visible; } .ci button:hover { color:var(--head); background:none; }
  @media (hover:none) { .ci button { visibility:visible; } }
  .ci.rel { flex-wrap:nowrap; align-items:baseline; } .ci.rel > .k { flex:none; } .ci.rel .link { visibility:visible; width:auto; padding:0; font-size:inherit; flex:1; min-width:0; overflow-wrap:anywhere; color:var(--accent-text); }
  .palette { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
  .swatch { width:22px; height:22px; min-height:0; border-radius:50%; padding:0; }
  .swatch:hover { box-shadow:0 0 0 2px var(--bg), 0 0 0 3px var(--line-strong); }
  .swatch.on { box-shadow:0 0 0 2px var(--bg), 0 0 0 4px var(--head); }
  .swatch.none { background:var(--card); color:var(--muted); border:1px solid var(--line-strong); }
  .editor { display:flex; flex-direction:column; gap:8px; }
  .editor input[type=date] { width:auto; }
  .editor textarea { min-height:180px; font-family:var(--mono); font-size:13px; }
  .editor .actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
  .preview { border:1px dashed var(--line-strong); border-radius:8px; padding:8px 12px; }
  .chip-input { position:relative; display:flex; flex-wrap:wrap; align-items:center; gap:4px; background:var(--input); border:1px solid var(--input-line); border-radius:4px; padding:3px 4px; min-height:36px; }
  .chip-input:focus-within { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-soft); }
  .chip-input input:not([type=checkbox]) { flex:1; min-width:120px; min-height:26px; padding:2px 4px; background:none; border:0; box-shadow:none !important; }
  .chip { display:inline-flex; align-items:center; gap:0; }
  .chip button { padding:0; width:20px; min-height:20px; background:none; color:var(--muted); } .chip button:hover { color:var(--head); background:none; }
  .suggest { position:absolute; left:0; top:100%; z-index:30; min-width:220px; max-height:260px; overflow-y:auto; margin-top:4px; padding:4px;
             background:var(--menu); border:1px solid var(--line); border-radius:8px; box-shadow:0 8px 24px var(--shadow); }
  .suggest .opt { padding:6px 8px; border-radius:4px; cursor:pointer; }
  .suggest .opt.on, .suggest .opt:hover { background:var(--accent-soft); }
  .suggest .none { padding:6px 8px; color:var(--muted); }

  /* polls */
  .poll { display:flex; flex-direction:column; gap:6px; max-width:440px; margin-top:6px; padding:12px; background:var(--card); border:1px solid var(--line); border-radius:8px; }
  .poll .opt { position:relative; display:flex; justify-content:flex-start; gap:8px; text-align:left; background:var(--input); border:1px solid var(--line); overflow:hidden; min-height:36px; font-weight:500; }
  .poll .opt:hover { border-color:var(--line-strong); background:var(--input); }
  .poll .opt:disabled { cursor:default; opacity:1; }
  .poll .opt > :not(.bar) { position:relative; }
  .poll .bar { position:absolute; left:0; top:0; bottom:0; background:var(--accent-soft); }
  .poll .opt.mine { border-color:var(--accent); }
  .poll .opt.mine > .ic { color:var(--accent-text); }
  .poll .opt.lead { color:var(--head); font-weight:600; } .poll .opt.lead .bar { background:color-mix(in oklab, var(--ok) 22%, transparent); }
  .poll > .row { gap:8px; font-size:12px; }

  /* menus, dialogs, toasts */
  .menu { position:fixed; z-index:40; min-width:200px; max-width:min(360px, 92vw); display:flex; flex-direction:column; gap:1px; background:var(--menu); border:1px solid var(--line);
          border-radius:8px; padding:6px; box-shadow:0 12px 32px var(--shadow); animation:pop .14s var(--ease); }
  @keyframes pop { from { opacity:0; transform:translateY(-4px) scale(.98); } }
  .menu button { background:none; justify-content:flex-start; text-align:left; padding:0 8px; min-height:32px; font-size:14px; font-weight:500; color:var(--text); }
  .menu button .ic { color:var(--muted); }
  .menu button:hover, .menu button:focus { background:var(--accent-soft); color:var(--head); outline:none; }
  .menu button:hover .ic, .menu button:focus .ic { color:var(--accent-text); }
  .menu button.danger { color:var(--danger); font-weight:500; }
  .menu button.danger:hover, .menu button.danger:focus { background:var(--danger-strong); color:var(--on-danger); box-shadow:none; }
  .menu .mark { width:16px; display:inline-flex; flex:none; }
  .menu .sep { margin:4px 6px; }
  .menu button.danger .ic { color:inherit; }
  .menu.emoji { display:grid; grid-template-columns:repeat(8, 38px); min-width:0; }
  .menu.emoji button { font-size:20px; padding:0; justify-content:center; min-height:38px; }
  .menu.pins { width:min(360px, 92vw); max-height:60vh; overflow-y:auto; }
  .menu.pins button { display:block; white-space:normal; overflow-wrap:anywhere; padding:6px 8px; font-weight:400; }
  dialog.dlg { background:var(--bg); color:var(--text); border:1px solid var(--line); border-radius:8px; padding:20px; width:min(460px, 92vw);
               box-shadow:0 24px 64px var(--shadow); animation:pop .18s var(--ease); }
  dialog.dlg::backdrop { background:var(--backdrop); }
  dialog.dlg h2 { margin:0 0 16px; color:var(--head); font-size:20px; font-weight:700; letter-spacing:-.01em; display:flex; align-items:center; gap:8px; }
  dialog.dlg label { display:block; margin:14px 0 6px; font-size:12px; font-weight:600; letter-spacing:.02em; text-transform:uppercase; color:var(--label); }
  dialog.dlg .actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; margin-top:20px; }
  dialog.dlg .modal-text { margin:0 0 12px; color:var(--head); font-size:15px; white-space:pre-wrap; }
  dialog.dlg input:not([type=checkbox]):not([type=radio]) { width:100%; }
  dialog.dlg p.k { line-height:1.5; }
  dialog.wide { width:min(660px, 94vw); max-height:88vh; overflow-y:auto; }
  .sect { display:flex; align-items:center; gap:8px; margin:24px 0 8px; font-size:12px; font-weight:600; letter-spacing:.03em; text-transform:uppercase; color:var(--label); }
  .sect:first-of-type { margin-top:8px; }
  .acl { background:var(--card); border:1px solid var(--line); border-radius:8px; padding:8px 12px; margin:6px 0; overflow-wrap:anywhere; }
  .acl .row { gap:8px; }
  .acl code { font-family:var(--mono); font-size:12px; }
  .checks { display:flex; flex-wrap:wrap; gap:6px 16px; margin-top:6px; }
  dialog.dlg .checks label { display:flex; gap:6px; align-items:center; margin:0; font-size:13px; font-weight:400; letter-spacing:0; text-transform:none; color:var(--text); cursor:pointer; }
  .invite-form { display:flex; flex-wrap:wrap; gap:8px; } .invite-form select { flex:1; min-width:120px; width:auto; }
  .secret { flex-direction:column; align-items:stretch; gap:6px; }
  .secret code { display:block; font-family:var(--mono); font-size:12px; word-break:break-all; user-select:all; }
  .avatar-row { display:flex; flex-wrap:wrap; align-items:center; gap:12px; } .avatar-row .ava { width:64px; height:64px; font-size:28px; }
  .rule-form { display:flex; flex-direction:column; gap:6px; } .rule-form .row { gap:6px; flex-wrap:wrap; } .rule-form select { max-width:100%; width:auto; flex:1; }
  .rule-form label { margin-bottom:0 !important; }
  .broken { color:var(--danger); display:flex; align-items:center; gap:6px; }
  #toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); z-index:50; max-width:min(520px, calc(100vw - 32px)); background:var(--toast); color:var(--toast-text);
           padding:10px 16px; border-radius:8px; font-weight:500; box-shadow:0 8px 24px var(--shadow); animation:rise .2s var(--ease); }
  @keyframes rise { from { opacity:0; transform:translate(-50%, 8px); } }
  #offline { display:none; position:fixed; top:8px; left:50%; transform:translateX(-50%); background:var(--danger-strong); color:var(--on-danger); padding:4px 12px; border-radius:4px;
             font-weight:600; z-index:20; box-shadow:0 4px 12px var(--shadow); }

  /* unread, mentions, presence */
  .badge { display:inline-block; background:var(--accent); color:var(--on-accent); border-radius:8px; font-size:11px; font-weight:700; line-height:16px; padding:0 5px; min-width:16px; text-align:center; }
  .dot { position:relative; display:inline-flex; }
  .dot::after { content:''; position:absolute; right:-2px; bottom:-2px; width:10px; height:10px; border-radius:50%; background:var(--offline); box-shadow:0 0 0 3px var(--side); }
  .dot:has(.mini)::after { width:8px; height:8px; box-shadow:0 0 0 2px var(--side); }

  .dot.on::after { background:var(--ok); } .dot.idle::after { background:var(--warn); } .dot.dnd::after { background:var(--danger); }
  .status { display:block; font-size:12px; color:var(--muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
  .chan .ava.mini { flex:none; }

  /* lists in the main area and the right panel: mentions, inbox, archive, audit, search, threads, forum */
  #archive, #mentions, #audit { flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:6px; }
  .mitem, .result, .arch { position:relative; display:block; width:100%; min-height:0; text-align:left; background:var(--card); border:1px solid var(--card-line); border-radius:8px;
                           padding:10px 12px; font-weight:400; color:var(--text); overflow-wrap:anywhere; }
  button.mitem:hover, button.result:hover, button.arch:hover { background:var(--card-hover); border-color:var(--line-strong); color:var(--text); }
  .mitem, .result, .arch { flex:none; }
  .arch { display:flex; justify-content:flex-start; gap:8px; align-items:center; }
  .arch.on, .result.post.on { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent); }
  .mitem.new { background:color-mix(in oklab, var(--accent) 7%, var(--card)); border-color:color-mix(in oklab, var(--accent) 35%, var(--card-line)); }
  .mitem.new::after { content:''; position:absolute; right:12px; top:14px; width:8px; height:8px; border-radius:50%; background:var(--accent); }
  .mitem > div + div, .result > div + div { margin-top:2px; }
  .mitem b, .result b { color:var(--head); font-weight:600; }
  .mitem .row .ic, .result .ic, .mitem > div > .ic { color:var(--muted); }
  .result { margin-bottom:6px; }
  .result .k { font-size:12px; }
  .result .row { gap:6px; }
  .result .unread-dot, .unread-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--accent); flex:none; }
  .scope { display:flex; flex-wrap:wrap; align-items:center; gap:4px; margin-bottom:10px; }
  .scope button { min-height:30px; }
  .scope button.on { background:var(--accent); color:var(--on-accent); }
  .k.inline-ic, .k:has(> .ic) { display:flex; align-items:center; gap:4px; }
  #panel { width:280px; flex:none; background:var(--side); border-left:1px solid var(--line); display:flex; flex-direction:column; }
  #panel-body { flex:1; overflow-y:auto; padding:8px 12px; }
  #panel-body > .cat:first-child { margin-top:8px; }
  .person-row { display:flex; align-items:center; gap:10px; padding:6px 8px; border-radius:4px; }
  .person-row:hover { background:var(--hover); }
  .person-row .grow { color:var(--text); font-weight:500; }
  .person-row.off { opacity:.55; } .person-row.off:hover { opacity:1; }

  /* filters bar */
  #main { container:main / inline-size; }
  #filters { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:12px 16px 0; font-size:13px; }
  .filters-body { display:flex; flex-wrap:wrap; align-items:center; gap:8px; min-width:0; }
  .filters-toggle { display:none !important; }
  .filters-toggle .badge { margin-left:2px; }
  .filters-body > input:not([type=checkbox]) { width:150px; min-height:32px; padding:4px 10px; }
  #filters .status-field { color:var(--muted); margin-left:8px; padding-left:16px; border-left:1px solid var(--line); } /* a second control, not one phrase with «Просрочено» */
  /* the bar folds behind «Фильтры» where it would wrap: phones, the task panel open */
  @container main (max-width: 999px) {
    .filters-toggle { display:inline-flex !important; color:var(--label); }
    #filters:not(.open) .filters-body { display:none; }
    #filters.open .filters-body { flex-basis:100%; }
  }
  #filters select { width:auto; min-height:32px; padding-top:4px; padding-bottom:4px; }
  #filters .chip-input { width:150px; min-width:150px; min-height:32px; padding:1px 4px; } #filters .chip-input input { min-width:80px; }
  #filters label { display:flex; gap:6px; align-items:center; cursor:pointer; color:var(--label); }
  #filters button.ghost { min-height:32px; }

  /* history */
  .forum-bar { gap:8px; margin-bottom:12px; align-items:center; }
  .label.tag { border:none; cursor:pointer; min-height:0; padding:0 10px 0 8px; line-height:24px; border-radius:12px; font-weight:500; }
  .label.tag:hover { color:var(--head); background:var(--btn-hover); }
  .label.tag.on { background:var(--accent-soft); color:var(--head); box-shadow:inset 0 0 0 1px var(--accent); }
  #forum { flex:1; overflow:auto; padding:16px; }
  #forum[hidden] { display:none; }

  /* time tracking, reports, CRM */
  #report { flex:1; overflow:auto; padding:16px; }
  #report .scope input { width:auto; min-height:30px; padding:2px 8px; }
  #report h3, .crm h3 { font-size:12px; font-weight:600; letter-spacing:.03em; text-transform:uppercase; color:var(--label); margin:20px 0 8px; }
  table.report { border-collapse:collapse; min-width:min(520px, 100%); margin-bottom:16px; background:var(--card); border:1px solid var(--line); border-radius:8px; overflow:hidden; }
  table.report th { font-size:12px; font-weight:600; color:var(--muted); background:var(--side); }
  table.report th, table.report td { text-align:left; padding:8px 12px; border-bottom:1px solid var(--line); }
  table.report tr:last-child td { border-bottom:0; }
  table.report td:last-child, table.report th:last-child { text-align:right; white-space:nowrap; }
  table.report .total td { font-weight:700; color:var(--head); background:var(--side); }
  .tiles { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0 4px; }
  .tile { background:var(--card); border:1px solid var(--line); border-radius:8px; padding:10px 14px; display:flex; flex-direction:column; min-width:120px; }
  .tile b { font-size:22px; font-weight:700; color:var(--head); line-height:1.2; } .tile span { color:var(--muted); font-size:12px; }
  .crm { display:flex; gap:16px; align-items:flex-start; flex-wrap:wrap; }
  .crm-list { width:260px; flex:none; display:flex; flex-direction:column; gap:4px; } .crm-list h3 { margin:12px 0 4px; }
  .crm-card { flex:1; min-width:280px; } .crm-card h2 { margin:0; font-size:20px; font-weight:700; color:var(--head); display:flex; align-items:center; gap:8px; }
  .crm-card h2 .ic { width:20px; height:20px; color:var(--muted); }

  /* Gantt */
  .g-tools { position:sticky; left:0; }
  .gantt { position:relative; margin-top:8px; }
  .g-row { display:flex; height:32px; align-items:center; border-bottom:1px solid var(--line); }
  .g-row.on { background:var(--accent-soft); }
  .g-name { position:sticky; left:0; z-index:2; width:200px; flex:none; height:100%; display:flex; align-items:center; gap:4px; padding:0 8px; background:var(--bg);
    overflow:hidden; white-space:nowrap; text-overflow:ellipsis; border-right:1px solid var(--line); }
  button.g-name { display:block; line-height:32px; border-radius:0; color:var(--text); font-weight:400; min-height:0; }
  .g-row.on button.g-name { color:var(--head); font-weight:600; }
  .g-col .g-name { font-size:12px; font-weight:600; letter-spacing:.03em; text-transform:uppercase; color:var(--muted); }
  .g-track { position:relative; height:100%; flex:none; }
  .g-bar { position:absolute; top:6px; height:20px; min-height:0; padding:0 6px; border-radius:4px; color:var(--on-hue); font-size:12px; font-weight:500; line-height:20px; text-align:left;
    display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
  .g-bar.plain { background:var(--accent); color:var(--on-accent); }
  .g-bar.late { background:var(--danger-strong); color:var(--on-danger); box-shadow:0 0 0 1px var(--danger); }
  .g-head .g-name { font-size:12px; color:var(--muted); }
  .g-day { position:absolute; top:8px; font-size:11px; color:var(--muted); white-space:nowrap; }
  .g-day.off { opacity:.6; } .g-day.month { color:var(--text); font-weight:600; opacity:1; } .g-day.now { color:var(--accent-text); font-weight:700; }
  .g-today { position:absolute; top:0; bottom:0; width:2px; background:var(--accent); z-index:1; pointer-events:none; }
  .g-arrows { position:absolute; top:0; z-index:1; pointer-events:none; overflow:visible; }
  .g-arrows path { fill:none; stroke:var(--label); stroke-width:1.5; } .g-arrows path.bad { stroke:var(--danger); stroke-width:2; }
  .g-arrows marker path { fill:var(--label); stroke:none; } .g-arrows #g-head-bad path { fill:var(--danger); }
  .g-undated { margin-top:12px; position:sticky; left:0; } .g-undated summary { cursor:pointer; color:var(--muted); }

  /* voice */
  .vpeer { display:flex; align-items:center; gap:6px; padding:2px 8px 2px 32px; color:var(--muted); font-size:13px; min-height:28px; }
  .chan.here > .ic:first-child { color:var(--ok-text); }
  .row:has(> .chan.here) > .gear { visibility:visible; }
  button.vinvite { width:100%; justify-content:flex-start; background:none; border-radius:6px; font-weight:400; min-height:32px; }
  button.vinvite:hover { background:var(--hover); color:var(--text); }
  .vinvite-ic { width:20px; height:20px; border-radius:50%; border:1px dashed var(--line-strong); display:inline-flex; align-items:center; justify-content:center; flex:none; }
  .vinv-list { max-height:280px; overflow-y:auto; margin:8px 0 16px; display:flex; flex-direction:column; gap:2px; }
  .vinv-row { display:flex; align-items:center; gap:8px; padding:4px 6px; border-radius:6px; }
  .vinv-row:hover { background:var(--hover); }
  .vinv-row button { min-height:30px; padding:0 12px; }
  .vava { display:inline-flex; border-radius:50%; transition:box-shadow .1s; }
  .vava.speaking { box-shadow:0 0 0 2px var(--ok); }
  .voff { display:inline-flex; color:var(--danger); }
  .live { background:var(--danger-strong); color:var(--on-danger); border-radius:3px; font-size:10px; font-weight:700; padding:1px 4px; margin-left:4px; }
  #voice { flex:1; overflow:auto; padding:16px; display:flex; flex-direction:column; gap:16px; }
  #voice[hidden] { display:none; }
  /* a voice channel with its chat: people on the left, the chat on the right (as in Discord) */
  #main.vsplit { display:grid; grid-template-columns:minmax(0, 1fr) clamp(340px, 40%, 480px); grid-template-rows:auto auto minmax(0, 1fr); }
  #main.vsplit > * { grid-column:1 / -1; }
  #main.vsplit > header { grid-row:1; } #main.vsplit > #rules-bar { grid-row:2; }
  #main.vsplit > #voice { grid-column:1; grid-row:3; }
  #main.vsplit > #main-chat { grid-column:2; grid-row:3; border-left:1px solid var(--line); background:var(--bg); }
  @media (max-width:900px) { #main.vsplit { grid-template-columns:minmax(0, 1fr); grid-template-rows:auto auto auto minmax(0, 1fr); }
    #main.vsplit > #voice { grid-column:1; grid-row:3; max-height:40vh; } #main.vsplit > #main-chat { grid-column:1; grid-row:4; border-left:0; border-top:1px solid var(--line); } }
  button.gear.lit { visibility:visible; color:var(--head); }
  .vgrid { display:flex; flex-wrap:wrap; gap:12px; }
  .vtile { background:var(--card); border:1px solid var(--line); border-radius:8px; padding:16px; width:160px; display:flex; flex-direction:column; align-items:center; gap:8px; }
  .vtile .row { gap:4px; color:var(--head); font-weight:500; }
  .vtile.cam { width:240px; } .vtile.cam .vava { border-radius:8px; }
  .vtile video { display:block; width:208px; aspect-ratio:4/3; object-fit:cover; border-radius:8px; background:#000; }
  .vshare video { display:block; max-width:100%; max-height:60vh; background:#000; border-radius:8px; }
  .vshare .k { display:flex; align-items:center; gap:4px; margin-top:4px; }

  /* scheduled events */
  .event h2 { margin:8px 0 12px; color:var(--head); font-size:18px; font-weight:700; overflow-wrap:anywhere; }
  .ev-status { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:600; padding:2px 8px; border-radius:10px; background:var(--card); color:var(--label); }
  .ev-status.live { background:var(--danger-strong); color:var(--on-danger); } .ev-status.cancelled { text-decoration:line-through; }

  /* knowledge base (hidden for now) */
  #wiki { flex:1; overflow-y:auto; padding:16px 24px; }
  #wiki[hidden] { display:none; }
  #wiki > h2 { margin:4px 0; color:var(--head); font-size:24px; overflow-wrap:anywhere; }
  #wiki .page-text { min-height:320px; }
  #wiki .editor .actions { display:flex; gap:8px; align-items:center; }
  #wiki .note { flex-wrap:wrap; }
  .twisty { width:20px; flex:none; padding:0; text-align:center; }

  /* narrower screens */
  @media (max-width:900px) { #side { width:200px; } #me { width:calc(72px + 200px - 16px); } #thread { position:fixed; inset:0; width:auto; z-index:10; } #panel { display:none; } }
  /* phones: the rail and the sidebar are a drawer (menu button), columns snap, panels take the screen */
  #menu-btn, .narrow-only { display:none; }
  @media (max-width:700px) {
    body { height:100dvh; } /* the composer stays above the on-screen keyboard */
    #menu-btn { display:inline-flex; }
    .narrow-only { display:inline-flex; align-items:center; gap:4px; } .wide-only { display:none; }
    #rail, #side { position:fixed; top:0; bottom:0; z-index:25; transition:transform .25s var(--ease); transform:translateX(-110vw); }
    #rail { left:0; } #side { left:72px; width:min(280px, calc(100vw - 72px)); }
    body.drawer #rail, body.drawer #side { transform:none; }
    #me { z-index:26; width:calc(72px + min(280px, 100vw - 72px) - 16px); transition:transform .25s var(--ease); transform:translateX(-110vw); }
    body.drawer #me { transform:none; }
    #scrim { position:fixed; inset:0; z-index:24; background:var(--backdrop); }
    /* the header wraps: the title on its own line, the tools under it */
    #main > header { flex-wrap:wrap; height:auto; min-height:48px; padding:2px 4px; gap:2px; }
    #main > header h1 { flex:1 1 calc(100% - 56px); }
    .search { flex:1 1 80px; min-width:0; }
    #search, #search:focus { width:100%; min-width:0; padding:8px 8px 8px 28px; }
    #filters { padding:8px 8px 0; gap:6px; }
    .filters-body > input:not([type=checkbox]), #filters .chip-input, .filters-body > .status-field { flex:1 1 40%; width:auto; min-width:0; }
    #filters .status-field select { flex:1; min-width:0; }
    #filters .status-field { margin-left:0; padding-left:0; border-left:0; } /* on its own row here */
    #kanban { scroll-snap-type:x mandatory; padding:12px 7.5vw; gap:8px; }
    .col { width:85vw; scroll-snap-align:center; }
    #thread, #panel:not([hidden]) { display:flex; position:fixed; inset:0; width:auto; z-index:10; }
    input, select, textarea { font-size:16px !important; } /* no zoom on focus in iOS */
    button, select, .chan { min-height:44px; }
    button.ghost, .srv { min-width:44px; }
    .chip button, button.link, .md button, .palette button, .g-bar, .g-name, .label.tag { min-height:0; min-width:0; } /* ponytail: colour dots stay small, nine fit a row */
    .tools button { min-height:40px; width:40px; }
    .composer .attach > button { width:40px; min-height:40px; }
    #panel > header, #thread > header { padding:0 4px 0 12px; }
    .dlg { max-width:calc(100vw - 16px); }
  }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation:none !important; transition:none !important; } }
  /* bots (automations, incoming webhooks): an icon avatar on the accent wash */
  .ava.bot-ava { background:var(--accent-soft); color:var(--accent-text); }

  /* header segments: a board's tabs, the people filter */
  .seg { display:inline-flex; gap:2px; padding:2px; margin-right:6px; border-radius:6px; background:var(--side); }
  .seg button { gap:6px; height:28px; min-height:28px; padding:0 10px; background:none; color:var(--muted); font-size:13px; font-weight:500; border-radius:4px; }
  .seg button .ic { width:14px !important; height:14px !important; }
  .seg button:hover { color:var(--head); background:var(--hover); }
  .seg button.on { background:var(--active); color:var(--head); }
  select.rep-target { width:auto; height:30px; min-height:30px; padding-top:0; padding-bottom:0; margin-right:6px; }

  /* menus: headings, notes, a slider */
  .menu.server-menu { width:232px; }
  .menu.voice-menu { width:260px; }
  .menu-head { padding:8px 8px 2px; font-size:11px; font-weight:700; letter-spacing:.03em; text-transform:uppercase; color:var(--muted); }
  .menu-note { padding:4px 8px 6px; font-size:12px; color:var(--muted); }
  .menu-slider { display:flex; align-items:center; gap:10px; padding:4px 8px 8px; }
  .menu-slider input[type=range], .sw-body input[type=range] { flex:1; accent-color:var(--accent); }
  .menu-slider .k { width:40px; text-align:right; font-size:12px; font-variant-numeric:tabular-nums; }

  /* settings windows: sections on the left, the chosen one on the right */
  dialog.settings-win { width:min(1080px, calc(100vw - 48px)); height:min(760px, calc(100vh - 48px)); max-width:none; max-height:none; padding:0; display:flex; overflow:hidden;
                        background:var(--bg); color:var(--text); border:1px solid var(--line); border-radius:12px; box-shadow:0 24px 64px var(--shadow); }
  dialog.settings-win:not([open]) { display:none; }
  dialog.settings-win::backdrop { background:var(--backdrop); }
  .sw-nav { width:248px; flex:none; display:flex; flex-direction:column; gap:1px; padding:20px 10px; overflow-y:auto; background:var(--side); }
  .sw-head { display:flex; align-items:center; gap:10px; padding:4px 8px 12px; }
  .sw-head b { display:block; color:var(--head); font-size:15px; }
  .sw-head button.link { min-height:0; padding:0; font-size:12px; }
  .sw-group { margin:14px 10px 4px; font-size:12px; font-weight:600; letter-spacing:.02em; text-transform:uppercase; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .sw-sep { height:1px; margin:10px 10px; background:var(--line); }
  .sw-item { justify-content:flex-start; gap:10px; min-height:36px; padding:0 10px; background:none; color:var(--label); font-size:15px; font-weight:500; border-radius:6px; text-align:left; }
  .sw-item .ic { color:var(--muted); }
  .sw-item:hover { background:var(--hover); color:var(--head); }
  .sw-item.on { background:var(--active); color:var(--head); }
  .sw-item.on .ic, .sw-item:hover .ic { color:var(--head); }
  .sw-item.sw-danger, .sw-item.sw-danger .ic { color:var(--danger); }
  .sw-item.sw-danger:hover { background:var(--danger-soft); }
  .sw-main { position:relative; flex:1; min-width:0; display:flex; }
  .sw-body { flex:1; max-width:880px; overflow-y:auto; padding:40px 64px 48px 40px; outline:none; }
  .sw-body h2 { margin:0 0 20px; color:var(--head); font-size:20px; font-weight:700; letter-spacing:-.01em; }
  .sw-body h3 { margin:32px 0 4px; color:var(--head); font-size:16px; font-weight:600; }
  .sw-body label { display:block; margin:18px 0 6px; font-size:12px; font-weight:600; letter-spacing:.02em; text-transform:uppercase; color:var(--label); }
  .sw-body input:not([type=checkbox]):not([type=radio]):not([type=range]), .sw-body select { width:100%; }
  .sw-body .row > input { flex:1; width:auto; }
  .sw-body .actions { display:flex; justify-content:flex-end; gap:8px; margin-top:16px; }
  .sw-body .acl { margin:8px 0; }
  .sw-body .checks { display:flex; flex-wrap:wrap; gap:8px 16px; margin-top:8px; }
  .sw-body .checks label { display:flex; align-items:center; gap:6px; margin:0; font-size:13px; font-weight:400; letter-spacing:0; text-transform:none; color:var(--text); cursor:pointer; }
  .sw-close { position:absolute; top:16px; right:16px; width:36px; height:36px; min-height:36px; padding:0; border-radius:50%; border:1px solid var(--line-strong); color:var(--label); }
  .sw-card { overflow:hidden; border-radius:8px; background:var(--side); }
  .sw-banner { height:72px; background:var(--accent-soft); }
  .sw-who { display:flex; align-items:flex-end; gap:12px; margin-top:-28px; padding:0 16px; }
  .sw-who .ava { box-shadow:0 0 0 6px var(--side); }
  .sw-who b { flex:1; padding-bottom:8px; color:var(--head); font-size:18px; }
  .sw-who button { margin-bottom:8px; }
  .sw-rows { margin:16px; padding:0 16px; border-radius:8px; background:var(--bg); }
  .sw-row { display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
  .sw-row:last-child { border-bottom:0; }
  .sw-row .grow { white-space:normal; }
  .sw-label { margin-bottom:2px; font-size:12px; font-weight:600; letter-spacing:.02em; text-transform:uppercase; color:var(--label); }
  .sw-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
  .sw-grid label { margin-top:0; }
  .sw-body .radios { display:flex; flex-direction:column; gap:10px; }
  .sw-body .radios label { display:flex; align-items:center; gap:10px; margin:0; font-size:14px; font-weight:500; letter-spacing:0; text-transform:none; color:var(--text); cursor:pointer; }
  .sw-body .avatar-row { margin-top:4px; }
  .themes { display:flex; flex-wrap:wrap; gap:12px; }
  .theme-pick { flex-direction:column; gap:8px; width:128px; padding:10px; background:var(--side); color:var(--text); font-size:13px; border:2px solid transparent; border-radius:8px; }
  .theme-pick:hover { background:var(--hover); }
  .theme-pick.on { border-color:var(--accent); color:var(--head); }
  .theme-pick .swatch { width:100%; height:56px; border-radius:6px; border:1px solid var(--line-strong); }
  .theme-pick.dark .swatch { background:#1b1e23; } .theme-pick.light .swatch { background:#f9fafb; }
  .theme-pick.system .swatch { background:linear-gradient(90deg, #1b1e23 50%, #f9fafb 50%); }

  /* «Пригласить на сервер»: the link and its copy button in one field */
  .copy-field { display:flex; align-items:center; gap:8px; padding:4px; background:var(--input); border:1px solid var(--input-line); border-radius:4px; }
  dialog.dlg .copy-field input { flex:1; border:0; background:none; box-shadow:none; padding:0 6px; }

  /* «Создать канал»: the kinds as a radio list */
  .kinds { display:flex; flex-direction:column; gap:6px; }
  .kind { justify-content:flex-start; gap:12px; width:100%; min-height:52px; padding:8px 12px; background:var(--side); color:var(--text); border-radius:6px; text-align:left; }
  .kind:hover { background:var(--hover); }
  .kind.on { background:var(--active); color:var(--head); }
  .kind .grow { display:flex; flex-direction:column; white-space:normal; line-height:1.3; }
  .kind b { color:var(--head); font-weight:600; }
  .kind .k { font-size:12px; }
  .radio-dot { width:18px; height:18px; flex:none; border-radius:50%; border:2px solid var(--muted); }
  .kind.on .radio-dot { border:5px solid var(--accent); }

  /* members (right panel): groups by role, then online, then offline */
  .member { display:flex; align-items:center; gap:10px; min-height:44px; padding:4px 8px; border-radius:4px; }
  .member:hover { background:var(--hover); }
  .member .grow { display:flex; flex-direction:column; line-height:1.25; white-space:normal; }
  .member .mname { display:flex; align-items:center; gap:4px; color:var(--head); font-size:15px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .member .k { font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .member.off { opacity:.5; } .member.off:hover { opacity:1; }
  .member button.ghost { width:32px; padding:0; visibility:hidden; }
  .member:hover button.ghost, .member button.ghost:focus-visible { visibility:visible; }
  @media (hover:none) { .member button.ghost { visibility:visible; } }
  .owner { display:inline-flex; color:var(--warn); }
  #panel-body > .cat { margin:16px 0 4px; }
  #panel-body > .cat:first-child { margin-top:4px; }

  /* «Люди» on the home screen */
  #people { flex:1; overflow-y:auto; padding:16px 24px; }
  #people[hidden] { display:none; }
  .people { max-width:960px; }
  .people .person { display:flex; align-items:center; gap:12px; min-height:60px; padding:0 10px; border-top:1px solid var(--line); border-radius:8px; }
  .people .person:hover { background:var(--hover); border-top-color:transparent; }
  .people .person:hover + .person { border-top-color:transparent; }
  .people .person .grow { display:flex; flex-direction:column; white-space:normal; line-height:1.3; }
  .people .person b { color:var(--head); font-size:15px; font-weight:600; }
  .people .person .k { font-size:13px; }
  button.round { width:36px; height:36px; min-height:36px; padding:0; border-radius:50%; background:var(--side); color:var(--label); }
  button.round:hover { background:var(--btn-hover); color:var(--head); }

  /* «Найти или начать беседу» */
  dialog.qs { width:min(560px, 94vw); }
  dialog.qs input { height:44px; font-size:16px; }
  .qs-list { display:flex; flex-direction:column; gap:1px; max-height:min(420px, 60vh); margin-top:10px; overflow-y:auto; }
  .qs-item { justify-content:flex-start; gap:10px; min-height:36px; padding:0 10px; background:none; color:var(--text); border-radius:4px; text-align:left; }
  .qs-item.on, .qs-item:hover { background:var(--accent-soft); color:var(--head); }
  .qs-item .k { max-width:45%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }

  /* a task put into a message */
  .task-embed { display:flex; flex-direction:column; gap:6px; max-width:440px; margin-top:6px; padding:10px 12px; background:var(--card); border:1px solid var(--card-line); border-radius:8px; }
  .task-embed.hued { background:color-mix(in oklab, var(--hue) 9%, var(--card)); border-color:color-mix(in oklab, var(--hue) 30%, var(--card-line)); }
  .te-where { display:flex; align-items:center; gap:6px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
  .te-title { justify-content:flex-start; min-height:0; padding:0; background:none; color:var(--head); font-size:15px; font-weight:600; text-align:left; }
  .te-title:hover { background:none; text-decoration:underline; }
  .te-foot { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
  .te-foot .avas { margin-left:0; padding-left:4px; }
  .te-open { height:28px; min-height:28px; margin-left:auto; padding:0 10px; font-size:13px; }
  .ac button .k { margin-left:auto; padding-left:12px; }

  /* phones: the settings window takes the screen, its sections become a row of tabs */
  @media (max-width:700px) {
    dialog.settings-win { width:100vw; height:100dvh; border-radius:0; border:0; flex-direction:column; }
    .sw-nav { width:auto; flex-direction:row; align-items:center; overflow-x:auto; padding:8px 56px 8px 8px; gap:4px; }
    .sw-nav .sw-group, .sw-nav .sw-sep, .sw-nav .sw-head { display:none; }
    .sw-item { flex:none; }
    .sw-main { min-height:0; }
    .sw-body { padding:20px 16px 32px; }
    .sw-body form.row { flex-wrap:wrap; } .sw-body form.row > input { flex-basis:100%; }
    .sw-close { top:8px; right:8px; }
    .sw-grid { grid-template-columns:1fr; }
    #people { padding:12px; }
  }
  .quote-box { max-height:120px; overflow:auto; padding:8px 10px; border-left:2px solid var(--quote); background:var(--side); border-radius:0 4px 4px 0; color:var(--text); font-size:13px; white-space:pre-wrap; }

  /* a bot's cards (Discord's embeds): the colour bar on the left is the sanctioned Discord embed bar */
  .embed { display:flex; flex-direction:column; gap:6px; max-width:520px; margin-top:6px; padding:10px 14px 12px 12px; background:var(--side); border:1px solid var(--line);
           border-left:4px solid var(--bar, var(--line-strong)); border-radius:4px 8px 8px 4px; }
  .em-author { font-size:13px; font-weight:600; color:var(--head); }
  .em-title { font-size:15px; font-weight:700; color:var(--head); text-decoration:none; }
  a.em-title { color:var(--accent-text); } a.em-title:hover { text-decoration:underline; }
  .embed .md { font-size:14px; }
  .em-fields { display:flex; flex-wrap:wrap; gap:8px 16px; }
  .em-field { flex:1 1 100%; min-width:0; } .em-field.inline { flex:1 1 140px; }
  .em-name { font-size:13px; font-weight:600; color:var(--head); }
  .em-foot { font-size:12px; color:var(--muted); }
  .acl.hook { gap:10px; } .acl.hook .grow { white-space:normal; }

  /* the picture viewer: the picture as large as fits, its name and actions above it */
  dialog.lightbox { width:100vw; height:100dvh; max-width:none; max-height:none; margin:0; padding:0; border:0; background:transparent; color:#f2f5f8;
                    display:flex; flex-direction:column; }
  dialog.lightbox:not([open]) { display:none; }
  dialog.lightbox::backdrop { background:rgba(5,6,8,.86); }
  .lb-bar { display:flex; align-items:center; gap:4px; height:52px; flex:none; padding:0 12px 0 20px; font-size:14px; }
  .lb-bar .grow { font-weight:600; }
  .lb-bar .k { color:#b3bcc7; margin-right:8px; font-variant-numeric:tabular-nums; }
  .lb-bar .ghost, .lb-bar a.button { color:#d5dbe2; }
  .lb-bar .ghost:hover, .lb-bar a.button:hover { background:rgba(255,255,255,.1); color:#ffffff; }
  a.button { display:inline-flex; align-items:center; gap:6px; min-height:32px; padding:0 10px; border-radius:4px; text-decoration:none; font-weight:500; }
  .lb-stage { outline:none; position:relative; flex:1; min-height:0; display:grid; place-items:center; padding:0 64px 24px; }
  .lb-img { max-width:100%; max-height:100%; object-fit:contain; border-radius:4px; box-shadow:0 24px 64px rgba(0,0,0,.5); }
  .lb-nav { position:absolute; top:50%; width:44px; height:44px; min-height:44px; margin-top:-34px; padding:0; border-radius:50%; background:rgba(255,255,255,.12); color:#ffffff; }
  .lb-nav:hover { background:rgba(255,255,255,.22); }
  .lb-nav.prev { left:12px; } .lb-nav.next { right:12px; }
  .md img { cursor:zoom-in; }
  @media (max-width:700px) { .lb-stage { padding:0 8px 16px; } .lb-nav { top:auto; bottom:24px; margin-top:0; } .lb-bar a.button { font-size:0; gap:0; } }

  /* a server's picture: in the rail it takes the button's shape (circle, squircle when open) */
  .srv .srv-img { width:100%; height:100%; object-fit:cover; display:block; border-radius:inherit; } /* not overflow:hidden: the pill and the badges stick out */
  .srv:has(.srv-img), .srv:has(.srv-img):hover, .srv.on:has(.srv-img) { background:var(--card); }
  .srv-pic { display:flex; align-items:flex-start; gap:16px; margin-bottom:20px; }
  .srv.big { width:80px; height:80px; border-radius:24px; font-size:32px; cursor:default; flex:none; }
  .srv.big::before { display:none; }
  .srv.big:hover { border-radius:24px; }

  /* server settings → «Люди»: tables of members and invites */
  .pm-tools { display:flex; align-items:center; gap:8px; margin:16px 0 8px; flex-wrap:wrap; }
  .sw-body #pm-q { width:220px; } /* an id: the settings' «every field is full width» rule is more specific than a class */
  .sw-body .pm-tools select { width:auto; }
  .pm-who .k { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .pm-table { border:1px solid var(--line); border-radius:8px; overflow:hidden; }
  .pm-row { display:grid; grid-template-columns:24px minmax(160px, 1.5fr) 124px 1fr 1.5fr 72px; align-items:center; gap:12px; min-height:52px; padding:6px 12px; border-top:1px solid var(--line); }
  .pm-table.inv .pm-row { grid-template-columns:1.2fr 96px 120px 90px 1.3fr 72px; }
  .pm-row:first-child { border-top:0; }
  .pm-row:not(.pm-head):hover { background:var(--hover); }
  .pm-row[hidden] { display:none; }
  .pm-head { min-height:34px; background:var(--side); font-size:12px; font-weight:600; letter-spacing:.02em; text-transform:uppercase; color:var(--label); }
  .pm-who { display:flex; align-items:center; gap:10px; min-width:0; }
  .pm-who .grow { white-space:normal; line-height:1.25; }
  .pm-who .mname { display:inline-flex; align-items:center; gap:4px; color:var(--head); font-weight:500; }
  .pm-cell { min-width:0; font-size:13px; font-variant-numeric:tabular-nums; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .pm-roles { display:flex; flex-wrap:wrap; gap:4px; align-items:center; min-width:0; }
  .pm-act { display:flex; justify-content:flex-end; gap:2px; }
  .pm-act button.ghost { width:32px; padding:0; }
  .role-chip { display:inline-flex; align-items:center; gap:5px; height:22px; padding:0 4px 0 7px; border-radius:11px; background:var(--side); border:1px solid var(--line); font-size:12px; color:var(--text); }
  .role-chip .x { width:16px; height:16px; min-height:0; padding:0; border-radius:50%; background:none; color:var(--muted); }
  .role-chip .x:hover { background:var(--hover); color:var(--head); }
  .role-dot { width:10px; height:10px; flex:none; border-radius:50%; background:var(--rc, var(--offline)); }
  .role-add { width:22px; height:22px; min-height:0; padding:0; border-radius:50%; background:var(--side); color:var(--muted); border:1px dashed var(--line-strong); }
  .role-add:hover { color:var(--head); border-style:solid; }
  .warn-text { color:var(--warn-text); }
  @media (max-width:900px) { .pm-row { grid-template-columns:24px 1fr auto auto; } .pm-row > :nth-child(3), .pm-row > :nth-child(4) { display:none; }
    .pm-table.inv .pm-row { grid-template-columns:1fr auto; } .pm-table.inv .pm-row > :nth-child(n+2):not(:last-child) { display:none; } }

  /* roles: the list and the editor (roles on the left, the chosen one with its tabs on the right) */
  .roles-hero { display:flex; align-items:center; gap:14px; padding:14px 16px; margin-bottom:12px; border-radius:8px; background:var(--side); }
  .roles-hero > .ic { color:var(--accent-text); }
  .role-row { display:flex; align-items:center; justify-content:flex-start; gap:12px; width:100%; min-height:48px; padding:0 12px; margin:2px 0; background:none; border-radius:6px; text-align:left; color:var(--text); }
  .role-row:hover { background:var(--hover); }
  .role-row .grow { display:flex; flex-direction:column; white-space:normal; line-height:1.3; }
  .role-row b { color:var(--head); font-weight:600; }
  .role-row.everyone { background:var(--side); border:1px solid var(--line); }
  .role-row .k { display:inline-flex; align-items:center; gap:2px; font-size:12px; }
  .re { display:grid; grid-template-columns:180px 1fr; gap:20px; }
  .re-side { display:flex; flex-direction:column; gap:1px; border-right:1px solid var(--line); padding-right:12px; }
  .re-top { display:flex; justify-content:space-between; margin-bottom:6px; }
  .re-top button.ghost:last-child { width:32px; padding:0; }
  .re-item { justify-content:flex-start; gap:8px; min-height:32px; padding:0 8px; background:none; color:var(--label); font-weight:500; border-radius:4px; text-align:left; }
  .re-item:hover { background:var(--hover); color:var(--head); }
  .re-item.on { background:var(--active); color:var(--head); }
  .re-main { min-width:0; }
  .re-head { display:flex; align-items:center; gap:8px; font-size:16px; color:var(--head); }
  .tabs { display:flex; gap:16px; margin:10px 0 14px; border-bottom:1px solid var(--line); }
  .tabs button { min-height:36px; padding:0; background:none; border-radius:0; color:var(--muted); font-weight:500; border-bottom:2px solid transparent; margin-bottom:-1px; }
  .tabs button:hover { color:var(--head); background:none; }
  .tabs button.on { color:var(--head); border-bottom-color:var(--accent); }
  .swatches { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
  .swatches .sw { width:36px; height:36px; min-height:0; padding:0; border-radius:8px; background:var(--rc); border:2px solid transparent; }
  .swatches .sw.on { box-shadow:0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
  .swatches .sw.none { background:var(--side); border:1px solid var(--line-strong); color:var(--muted); }
  .swatches .sw.custom { display:inline-grid; place-items:center; position:relative; background:var(--side); border:1px dashed var(--line-strong); color:var(--muted); cursor:pointer; margin:0; }
  .swatches .sw.custom input { position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%; }
  .sw-body .perm { display:flex; align-items:center; gap:16px; margin:0; padding:12px 0; border-bottom:1px solid var(--line); text-transform:none; letter-spacing:0; font-size:14px; font-weight:400; color:var(--text); cursor:pointer; }
  .sw-body .perm[hidden] { display:none; }
  .perm .grow { white-space:normal; }
  .perm b { color:var(--head); font-weight:600; }
  .perm .k { font-size:13px; margin-top:2px; }
  input.switch { appearance:none; -webkit-appearance:none; width:40px; height:24px; flex:none; margin:0; border-radius:12px; background:var(--line-strong); position:relative; cursor:pointer; transition:background-color .12s; }
  input.switch::after { content:''; position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%; background:#ffffff; transition:transform .15s var(--ease); }
  input.switch:checked { background:var(--accent); }
  input.switch:checked::after { transform:translateX(16px); }
  input.switch:disabled { opacity:.45; cursor:not-allowed; }
  @media (max-width:700px) { .re { grid-template-columns:1fr; } .re-side { border-right:0; padding-right:0; flex-direction:row; overflow-x:auto; } }

  /* access: the mode as three cards, requests, rules */
  .access-cards { display:grid; grid-template-columns:repeat(3, 1fr); gap:8px; margin-top:8px; }
  .access-card { flex-direction:column; align-items:center; gap:6px; min-height:120px; padding:14px 12px; background:var(--side); border:2px solid transparent; border-radius:8px; color:var(--text); text-align:center; white-space:normal; }
  .access-card b { color:var(--head); }
  .access-card .k { font-size:12px; line-height:1.35; }
  .access-card .ic { color:var(--muted); }
  .access-card:hover:not(:disabled) { background:var(--hover); }
  .access-card.on { border-color:var(--accent); background:var(--accent-soft); }
  .access-card.on .ic { color:var(--accent-text); }
  @media (max-width:700px) { .access-cards { grid-template-columns:1fr; } }
  .rules-edit { display:flex; flex-direction:column; gap:6px; margin-top:10px; }
  .rule { display:flex; align-items:center; gap:8px; }
  .rule-n { width:24px; height:24px; flex:none; display:grid; place-items:center; border-radius:50%; background:var(--side); color:var(--label); font-size:12px; font-weight:600; }
  .rule input { flex:1; }
  .rule button.ghost { width:32px; padding:0; }
  .add-rule { align-self:flex-start; }
  .examples { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-top:10px; }
  .chip-btn { min-height:26px; padding:0 10px; border-radius:13px; background:var(--side); border:1px solid var(--line); font-size:12px; color:var(--text); }
  .chip-btn:hover { border-color:var(--accent); color:var(--head); }
  .note.warn { background:var(--warn-soft); border-color:transparent; color:var(--warn-text); }
  .note.warn .ic { color:var(--warn-text); }
  #rules-bar { display:flex; align-items:center; gap:10px; padding:8px 16px; background:var(--warn-soft); color:var(--warn-text); font-weight:500; border-bottom:1px solid var(--line); }
  #rules-bar[hidden] { display:none; }
  .rules-read { margin:0 0 12px; padding-left:22px; display:flex; flex-direction:column; gap:6px; color:var(--text); }
  dialog.dlg label.agree { display:flex; align-items:center; gap:8px; margin:8px 0 0; text-transform:none; letter-spacing:0; font-size:14px; font-weight:500; color:var(--text); cursor:pointer; }
  .srv.small { display:grid; place-items:center; width:36px; height:36px; font-size:14px; flex:none; cursor:default; }
  .srv.big { display:grid; place-items:center; }
  .srv.small::before { display:none; }

  /* a member's card (click on a member or an author), as Discord's profile popout */
  .clickable { cursor:pointer; }
  .msg .who.clickable:hover { text-decoration:underline; }
  .member.clickable:focus-visible { outline:2px solid var(--focus, var(--accent)); outline-offset:-2px; }
  .ucard { position:fixed; z-index:40; width:300px; overflow:hidden; background:var(--menu); border:1px solid var(--line); border-radius:8px;
           box-shadow:0 12px 32px var(--shadow); animation:pop .14s var(--ease); }
  .uc-banner { height:60px; background:var(--rc, var(--accent-soft)); }
  .uc-head { display:flex; align-items:flex-end; justify-content:space-between; padding:0 12px; margin-top:-40px; }
  .uc-head .dot .ava { box-shadow:0 0 0 6px var(--menu); }
  .uc-head .dot::after { box-shadow:0 0 0 4px var(--menu); }
  .uc-head button.ghost { width:32px; padding:0; margin-bottom:4px; background:var(--side); border-radius:50%; }
  .uc-body { display:flex; flex-direction:column; gap:6px; padding:10px 16px 16px; }
  .uc-name { display:flex; align-items:center; gap:6px; color:var(--head); font-size:19px; font-weight:700; }
  .uc-sec { margin-top:6px; padding-top:10px; border-top:1px solid var(--line); font-size:12px; color:var(--label); }
  .uc-label { margin-top:4px; font-size:12px; font-weight:600; letter-spacing:.02em; text-transform:uppercase; color:var(--label); }
  .uc-roles { display:flex; flex-wrap:wrap; gap:4px; align-items:center; }
  .uc-roles .role-chip { padding-left:4px; }
  .role-chip .x.rdot { width:14px; height:14px; display:grid; place-items:center; background:var(--rc, var(--offline)); color:transparent; border-radius:50%; }
  .role-chip.removable:hover .x.rdot, .role-chip .x.rdot:focus-visible { color:#ffffff; }
  .role-chip .x.rdot .ic { width:10px; height:10px; }
  .role-add.on { border-style:solid; color:var(--accent-text); border-color:var(--accent); }
  .uc-pick { display:flex; flex-direction:column; gap:2px; margin-top:4px; padding:6px; max-height:220px; overflow-y:auto; background:var(--bg); border:1px solid var(--line); border-radius:6px; }
  .uc-pick input[type=search] { width:100%; height:30px; margin-bottom:4px; }
  .uc-opt { display:flex; align-items:center; gap:8px; min-height:30px; padding:0 6px; border-radius:4px; cursor:pointer; font-size:14px; color:var(--text); }
  .uc-opt:hover { background:var(--accent-soft); color:var(--head); }
  .uc-write { margin-top:10px; }
  .menu .role-dot { margin-right:-2px; }

  /* members: ticks, sortable headers, filters, the bar of actions for the ticked ones */
  .pm-tick { display:flex; align-items:center; }
  .pm-row.sel { background:var(--accent-soft); }
  .pm-row.sel:hover { background:var(--accent-soft); }
  .pm-head .th { white-space:nowrap; justify-content:flex-start; gap:4px; min-height:24px; height:24px; padding:0; background:none; font:inherit; letter-spacing:inherit; text-transform:inherit; color:inherit; }
  .pm-head .th:hover, .pm-head .th.on { color:var(--head); background:none; }
  .pm-head .th .ic { color:var(--accent-text); }
  .sw-body select.pm-filter { width:auto; height:30px; min-height:30px; padding-top:0; padding-bottom:0; font-size:13px; }
  .sw-body select.pm-filter.on { border-color:var(--accent); color:var(--head); }
  .pm-tools > .ic { color:var(--muted); }
  .pm-bulk { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:0 0 8px; padding:8px 12px; border-radius:8px; background:var(--accent-soft); border:1px solid var(--accent); }
  .pm-bulk b { color:var(--head); margin-right:4px; }
  .pm-bulk button { min-height:30px; height:30px; gap:6px; }
  button.danger-text { color:var(--danger); }
  button.danger-text:hover { background:var(--danger-soft); color:var(--danger); }
  button.link-like { justify-content:flex-start; min-height:0; padding:0; background:none; font:inherit; font-weight:500; color:var(--head); text-align:left; }
  button.link-like:hover { background:none; text-decoration:underline; }
  .pm-table .empty { padding:20px 12px; }
