    @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

    :root {
      --bg-0: #090b12;
      --bg-1: #0f1320;
      --bg-2: #151b2d;
      --panel: rgba(18, 23, 39, 0.84);
      --panel-solid: #11182a;
      --panel-2: rgba(24, 31, 52, 0.88);
      --line: rgba(143, 174, 255, 0.16);
      --line-strong: rgba(143, 174, 255, 0.32);
      --text: #e7ecff;
      --muted: #9aa6cc;
      --accent: #5eead4;
      --accent-2: #60a5fa;
      --ok: #4ade80;
      --warn: #fb7185;
      --btn-primary-bg: linear-gradient(145deg, #1d4ed8, #2563eb);
      --btn-primary-border: rgba(147, 197, 253, 0.45);
      --toggle-active-bg: linear-gradient(145deg, #0891b2, #2563eb);
      --toggle-active-border: rgba(125, 211, 252, 0.65);
      --toggle-active-shadow: rgba(37, 99, 235, 0.35);
      --range-accent: #3b82f6;
      --scroll-track: rgba(10, 14, 28, 0.9);
      --scroll-thumb: rgba(96, 165, 250, 0.45);
      --scroll-thumb-hover: rgba(125, 211, 252, 0.65);
      --control-bg: rgba(9, 14, 28, 0.9);
      --control-bg-soft: rgba(13, 20, 38, 0.72);
      --modal-overlay: rgba(2, 6, 16, 0.62);
      --transcript-overlay: rgba(12, 16, 32, 0.85);
      --transcript-stripe: rgba(143, 174, 255, 0.02);
      --transcript-drag-tint: rgba(96, 165, 250, 0.06);
      --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
      --radius-lg: 18px;
      --radius-md: 12px;
      --radius-sm: 9px;
    }
    body[data-theme="dark"] {
      --bg-0: #010204;
      --bg-1: #04060b;
      --bg-2: #070912;
      --panel: rgba(5, 7, 12, 0.94);
      --panel-solid: #05070b;
      --panel-2: rgba(8, 10, 16, 0.96);
      --line: rgba(148, 163, 184, 0.14);
      --line-strong: rgba(148, 163, 184, 0.28);
      --text: #e5e7eb;
      --muted: #9aa0ad;
      --accent: #a3a3a3;
      --accent-2: #d1d5db;
      --ok: #4ade80;
      --warn: #fb7185;
      --btn-primary-bg: linear-gradient(145deg, #3f3f46, #52525b);
      --btn-primary-border: rgba(161, 161, 170, 0.5);
      --toggle-active-bg: linear-gradient(145deg, #27272a, #3f3f46);
      --toggle-active-border: rgba(161, 161, 170, 0.6);
      --toggle-active-shadow: rgba(63, 63, 70, 0.36);
      --range-accent: #71717a;
      --scroll-track: rgba(2, 3, 6, 0.96);
      --scroll-thumb: rgba(75, 85, 99, 0.68);
      --scroll-thumb-hover: rgba(107, 114, 128, 0.86);
      --control-bg: rgba(10, 11, 15, 0.94);
      --control-bg-soft: rgba(14, 15, 20, 0.78);
      --modal-overlay: rgba(0, 0, 0, 0.78);
      --transcript-overlay: rgba(7, 8, 12, 0.9);
      --transcript-stripe: rgba(148, 163, 184, 0.028);
      --transcript-drag-tint: rgba(107, 114, 128, 0.07);
    }
    body[data-theme="crimson"] {
      --bg-0: #020203;
      --bg-1: #060708;
      --bg-2: #0b0c0f;
      --panel: rgba(8, 9, 12, 0.93);
      --panel-solid: #08090c;
      --panel-2: rgba(11, 12, 16, 0.95);
      --line: rgba(248, 113, 113, 0.22);
      --line-strong: rgba(248, 113, 113, 0.4);
      --text: #f4f4f5;
      --muted: #a1a1aa;
      --accent: #fb7185;
      --accent-2: #ef4444;
      --ok: #4ade80;
      --warn: #fb7185;
      --btn-primary-bg: linear-gradient(145deg, #991b1b, #dc2626);
      --btn-primary-border: rgba(252, 165, 165, 0.55);
      --toggle-active-bg: linear-gradient(145deg, #7f1d1d, #b91c1c);
      --toggle-active-border: rgba(248, 113, 113, 0.62);
      --toggle-active-shadow: rgba(185, 28, 28, 0.38);
      --range-accent: #ef4444;
      --scroll-track: rgba(7, 8, 11, 0.95);
      --scroll-thumb: rgba(113, 113, 122, 0.68);
      --scroll-thumb-hover: rgba(161, 161, 170, 0.86);
      --control-bg: rgba(15, 16, 20, 0.94);
      --control-bg-soft: rgba(18, 19, 24, 0.82);
      --modal-overlay: rgba(3, 1, 1, 0.8);
      --transcript-overlay: rgba(14, 11, 13, 0.9);
      --transcript-stripe: rgba(248, 113, 113, 0.03);
      --transcript-drag-tint: rgba(248, 113, 113, 0.08);
    }
    body[data-theme="dark"] {
      background:
        radial-gradient(70vw 45vh at 12% -10%, rgba(255, 255, 255, 0.04), transparent 70%),
        radial-gradient(50vw 40vh at 94% 112%, rgba(148, 163, 184, 0.06), transparent 70%),
        linear-gradient(160deg, #000000, #040507 42%, #06080c 100%);
    }
    body[data-theme="dark"] .channel-bubble,
    body[data-theme="dark"] .voice-inline,
    body[data-theme="dark"] .glass {
      background: rgba(7, 8, 11, 0.9);
    }
    body[data-theme="dark"] .channel-bubble .room-list-head,
    body[data-theme="dark"] .voice-head,
    body[data-theme="dark"] .chat-head {
      background: linear-gradient(180deg, rgba(107, 114, 128, 0.14), rgba(107, 114, 128, 0));
    }
    body[data-theme="dark"] .room-item {
      background: rgba(12, 14, 19, 0.88);
      border-color: rgba(148, 163, 184, 0.14);
    }
    body[data-theme="dark"] .room-item.active {
      border-color: rgba(156, 163, 175, 0.48);
      background: linear-gradient(135deg, rgba(75, 85, 99, 0.35), rgba(55, 65, 81, 0.16));
      color: #f3f4f6;
    }
    body[data-theme="dark"] .msg {
      background: rgba(12, 13, 17, 0.92);
      border-color: rgba(148, 163, 184, 0.16);
    }
    body[data-theme="dark"] .composer,
    body[data-theme="dark"] .side-rail {
      background: rgba(6, 7, 10, 0.92);
    }
    body[data-theme="dark"] .composer textarea,
    body[data-theme="dark"] .thread-compose textarea,
    body[data-theme="dark"] .voice-devices select {
      background: #0a0b10;
      border-color: rgba(148, 163, 184, 0.2);
    }
    body[data-theme="dark"] .embed {
      background: #08090d;
      border-color: rgba(148, 163, 184, 0.2);
    }
    body[data-theme="dark"] .embed img,
    body[data-theme="dark"] .embed video {
      background: #050607;
    }
    body[data-theme="dark"] .screens {
      background: rgba(5, 6, 9, 0.92);
    }
    body[data-theme="dark"] .screen-card {
      background: #050607;
      border-color: rgba(148, 163, 184, 0.2);
    }
    body[data-theme="dark"] .screen-head {
      background: rgba(17, 19, 24, 0.9);
      border-bottom-color: rgba(148, 163, 184, 0.18);
      color: #e5e7eb;
    }
    body[data-theme="dark"] .voice-meter-row {
      background: rgba(12, 13, 17, 0.9);
      border-color: rgba(148, 163, 184, 0.2);
    }
    body[data-theme="dark"] .voice-meter-track {
      background: #08090d;
      border-color: rgba(148, 163, 184, 0.2);
    }
    body[data-theme="dark"] .voice-meter-fill {
      background: linear-gradient(90deg, #9ca3af 0%, #22c55e 68%, #eab308 100%);
    }
    body[data-theme="dark"] .voice-pill,
    body[data-theme="dark"] .voice-settings-toggle {
      background: rgba(75, 85, 99, 0.2);
      border-color: rgba(156, 163, 175, 0.36);
      color: #e5e7eb;
    }
    body[data-theme="dark"] .reply-ref {
      border-left-color: rgba(156, 163, 175, 0.6);
      background: rgba(75, 85, 99, 0.2);
    }
    body[data-theme="dark"] .members-head {
      color: #e5e7eb;
    }
    body[data-theme="dark"] .member-row {
      border-color: rgba(148, 163, 184, 0.2);
      background: rgba(10, 11, 15, 0.9);
    }
    body[data-theme="dark"] .member-name {
      color: #e5e7eb;
    }
    body[data-theme="dark"] .member-sub {
      color: #9ca3af;
    }
    body[data-theme="dark"] .member-sub.voice {
      color: #e5e7eb;
      border-color: rgba(156, 163, 175, 0.45);
      background: rgba(75, 85, 99, 0.28);
    }
    body[data-theme="crimson"] {
      background:
        radial-gradient(70vw 45vh at 12% -10%, rgba(248, 113, 113, 0.06), transparent 70%),
        radial-gradient(50vw 40vh at 94% 112%, rgba(248, 113, 113, 0.08), transparent 70%),
        linear-gradient(160deg, #020203, #07080a 42%, #0b0c0f 100%);
    }
    body[data-theme="crimson"] .channel-bubble,
    body[data-theme="crimson"] .voice-inline,
    body[data-theme="crimson"] .glass {
      background: rgba(8, 9, 12, 0.9);
    }
    body[data-theme="crimson"] .channel-bubble .room-list-head,
    body[data-theme="crimson"] .voice-head,
    body[data-theme="crimson"] .chat-head {
      background: linear-gradient(180deg, rgba(248, 113, 113, 0.16), rgba(248, 113, 113, 0));
    }
    body[data-theme="crimson"] .room-item {
      background: rgba(13, 14, 18, 0.9);
      border-color: rgba(248, 113, 113, 0.16);
    }
    body[data-theme="crimson"] .room-item.active {
      border-color: rgba(252, 165, 165, 0.55);
      background: linear-gradient(135deg, rgba(127, 29, 29, 0.45), rgba(69, 10, 10, 0.28));
      color: #f4f4f5;
    }
    body[data-theme="crimson"] .msg {
      background: rgba(13, 14, 18, 0.92);
      border-color: rgba(248, 113, 113, 0.16);
    }
    body[data-theme="crimson"] .composer,
    body[data-theme="crimson"] .side-rail {
      background: rgba(8, 9, 12, 0.92);
    }
    body[data-theme="crimson"] .composer textarea,
    body[data-theme="crimson"] .thread-compose textarea,
    body[data-theme="crimson"] .voice-devices select {
      background: #101115;
      border-color: rgba(248, 113, 113, 0.22);
      color: #f4f4f5;
    }
    body[data-theme="crimson"] .embed {
      background: #0d0f13;
      border-color: rgba(248, 113, 113, 0.2);
    }
    body[data-theme="crimson"] .embed img,
    body[data-theme="crimson"] .embed video {
      background: #08090c;
    }
    body[data-theme="crimson"] .screens {
      background: rgba(7, 8, 11, 0.92);
    }
    body[data-theme="crimson"] .screen-card {
      background: #08090c;
      border-color: rgba(248, 113, 113, 0.2);
    }
    body[data-theme="crimson"] .screen-head {
      background: rgba(30, 8, 13, 0.88);
      border-bottom-color: rgba(248, 113, 113, 0.2);
      color: #ffe4e6;
    }
    body[data-theme="crimson"] .voice-meter-row {
      background: rgba(13, 14, 18, 0.9);
      border-color: rgba(248, 113, 113, 0.22);
    }
    body[data-theme="crimson"] .voice-meter-track {
      background: #0a0b0f;
      border-color: rgba(248, 113, 113, 0.22);
    }
    body[data-theme="crimson"] .voice-meter-fill {
      background: linear-gradient(90deg, #fb7185 0%, #ef4444 62%, #f59e0b 100%);
    }
    body[data-theme="crimson"] .voice-pill,
    body[data-theme="crimson"] .voice-settings-toggle {
      background: rgba(127, 29, 29, 0.25);
      border-color: rgba(248, 113, 113, 0.38);
      color: #ffe4e6;
    }
    body[data-theme="crimson"] .reply-ref {
      border-left-color: rgba(248, 113, 113, 0.72);
      background: rgba(153, 27, 27, 0.25);
    }
    body[data-theme="crimson"] .members-head,
    body[data-theme="crimson"] .member-name {
      color: #ffe4e6;
    }
    body[data-theme="crimson"] .member-row {
      border-color: rgba(248, 113, 113, 0.24);
      background: rgba(13, 14, 18, 0.9);
    }
    body[data-theme="crimson"] .member-sub {
      color: #a1a1aa;
    }
    body[data-theme="crimson"] .member-sub.voice {
      color: #ffe4e6;
      border-color: rgba(248, 113, 113, 0.55);
      background: rgba(185, 28, 28, 0.3);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: "Space Grotesk", "Segoe UI", sans-serif;
      color: var(--text);
      background:
        radial-gradient(70vw 45vh at 12% -10%, rgba(96, 165, 250, 0.22), transparent 70%),
        radial-gradient(50vw 40vh at 94% 112%, rgba(94, 234, 212, 0.2), transparent 70%),
        linear-gradient(160deg, var(--bg-0), #0a0d18 42%, #0c1020 100%);
      overflow: hidden;
      scrollbar-color: var(--scroll-thumb) var(--scroll-track);
    }
    * {
      scrollbar-color: var(--scroll-thumb) var(--scroll-track);
    }
    *::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }
    *::-webkit-scrollbar-track {
      background: var(--scroll-track);
      border-radius: 999px;
    }
    *::-webkit-scrollbar-thumb {
      background: var(--scroll-thumb);
      border-radius: 999px;
      border: 2px solid transparent;
      background-clip: content-box;
    }
    *::-webkit-scrollbar-thumb:hover {
      background: var(--scroll-thumb-hover);
      background-clip: content-box;
    }

    .hidden { display: none !important; }

    .login-screen {
      min-height: 100vh;
      display: grid;
      place-items: center;
      padding: 24px;
    }

    .login-card {
      width: min(520px, 100%);
      border: 1px solid var(--line);
      background: var(--panel);
      border-radius: 24px;
      padding: 28px;
      box-shadow: var(--shadow);
      text-align: center;
    }

    .login-title {
      margin: 0;
      font-size: 36px;
      font-weight: 700;
      letter-spacing: 0.4px;
    }

    .login-sub {
      margin: 10px 0 22px;
      color: var(--muted);
      font-size: 15px;
    }

    .app-shell {
      height: 100vh;
      padding-top: max(14px, env(safe-area-inset-top));
      padding-right: max(14px, env(safe-area-inset-right));
      padding-bottom: max(14px, env(safe-area-inset-bottom));
      padding-left: max(14px, env(safe-area-inset-left));
      display: grid;
      grid-template-columns: 300px minmax(0, 1fr);
      gap: 12px;
    }

    .glass {
      border: 1px solid var(--line);
      background: var(--panel);
      backdrop-filter: blur(10px);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow);
      min-height: 0;
    }

    .channels {
      display: grid;
      grid-template-rows: auto 1fr auto;
      overflow: hidden;
    }

    .channels-head {
      padding: 16px 16px 10px;
      border-bottom: 1px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }
    .channels-head-left {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
    }
    .channels-head-main {
      min-width: 0;
    }
    .mobile-channels-toggle {
      display: none;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(96, 165, 250, 0.12);
      color: #dbeafe;
      font-size: 12px;
      font-weight: 700;
      padding: 5px 8px;
      cursor: pointer;
    }

    .workspace {
      font-size: 18px;
      font-weight: 700;
      margin: 0;
    }

    .workspace-sub {
      margin: 4px 0 0;
      font-size: 12px;
      color: var(--muted);
      letter-spacing: 0.4px;
      text-transform: uppercase;
    }

    .room-list-wrap {
      padding: 12px;
      overflow: hidden;
      display: grid;
      grid-template-rows: minmax(0, 1fr) auto;
      gap: 10px;
    }
    .room-list-wrap.voice-hidden {
      grid-template-rows: minmax(0, 1fr);
    }
    .room-list-wrap.voice-hidden .voice-inline {
      display: none;
    }

    .room-list-title {
      margin: 0 0 9px;
      color: var(--muted);
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .room-list-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 9px;
    }
    .room-list-head .room-list-title { margin: 0; }
    .room-list-tools { display: flex; gap: 6px; }
    .icon-btn {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: rgba(96, 165, 250, 0.08);
      color: #c7d2fe;
      width: 24px;
      height: 24px;
      line-height: 22px;
      text-align: center;
      padding: 0;
      cursor: pointer;
    }
    .icon-btn:hover { background: rgba(96, 165, 250, 0.2); color: #fff; }
    .icon-btn.active {
      color: #fef3c7;
      border-color: rgba(245, 158, 11, 0.55);
      background: rgba(245, 158, 11, 0.22);
    }
    .icon-btn.notify-all {
      color: #93c5fd;
      border-color: rgba(59, 130, 246, 0.55);
      background: rgba(59, 130, 246, 0.2);
    }
    .icon-btn.notify-mentions {
      color: #fcd34d;
      border-color: rgba(234, 179, 8, 0.5);
      background: rgba(234, 179, 8, 0.16);
    }
    .icon-btn.notify-mute {
      color: #94a3b8;
      border-color: rgba(71, 85, 105, 0.5);
      background: rgba(71, 85, 105, 0.16);
    }
    .channel-bubble {
      border: 1px solid var(--line);
      border-radius: 12px;
      background: rgba(13, 18, 34, 0.76);
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      min-height: 0;
      overflow: hidden;
    }
    .channel-bubble .room-list-head {
      margin: 0;
      padding: 12px 12px 10px;
      border-bottom: 1px solid var(--line);
      background: linear-gradient(180deg, rgba(94, 234, 212, 0.1), rgba(94, 234, 212, 0));
    }
    .channel-bubble .room-list {
      padding: 10px;
    }
    .channel-sections {
      min-height: 0;
      overflow-y: auto;
      padding: 10px;
      display: grid;
      align-content: start;
      gap: 0;
    }
    .channel-sections > .room-list {
      overflow: visible;
      padding: 0;
    }
    .room-subsection {
      padding: 8px 0 0;
    }
    .room-subsection > .room-list {
      overflow: visible;
      padding: 0;
    }
    .room-divider {
      height: 1px;
      margin: 2px 0 8px;
      background: var(--line);
    }
    .room-list-head.room-list-head-sub {
      padding: 0 2px 8px;
      border-bottom: 0;
      background: transparent;
    }

    .room-list {
      display: grid;
      gap: 6px;
      overflow-y: auto;
      align-content: start;
      min-height: 0;
    }
    .room-block {
      display: grid;
      gap: 4px;
      min-width: 0;
    }
    .room-block.reorderable .room-item {
      cursor: grab;
    }
    .room-block.reorderable.dragging {
      opacity: 0.4;
    }
    .room-drop-marker {
      height: 0;
      border-top: 3px solid color-mix(in srgb, var(--accent) 76%, white 14%);
      border-radius: 999px;
      margin: 2px 6px;
      box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.5);
    }
    .room-voice-members {
      display: grid;
      gap: 4px;
      margin-left: 16px;
      padding-left: 6px;
      border-left: 1px solid var(--line);
    }
    .room-voice-member {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      min-width: 0;
    }
    .room-voice-member-left {
      display: inline-flex;
      align-items: center;
      min-width: 0;
      gap: 5px;
    }
    .room-voice-member-name {
      color: var(--muted);
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .room-voice-controls {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-width: 70px;
      flex-shrink: 0;
    }
    .room-voice-controls input[type="range"] {
      width: 68px;
      accent-color: var(--range-accent);
    }

    .room-item {
      width: 100%;
      text-align: left;
      border: 1px solid transparent;
      border-radius: 10px;
      background: rgba(12, 18, 38, 0.6);
      color: var(--muted);
      padding: 9px 10px;
      font-family: inherit;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: 120ms ease;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .room-item .left {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .room-item-right {
      margin-left: auto;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
    }
    .room-voice-btn {
      border: 1px solid rgba(96, 165, 250, 0.35);
      border-radius: 999px;
      background: rgba(15, 23, 42, 0.9);
      color: #bfdbfe;
      width: 26px;
      height: 26px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      cursor: pointer;
      padding: 0;
      line-height: 1;
    }
    .room-voice-btn:hover {
      border-color: rgba(125, 211, 252, 0.65);
      color: #fff;
      background: rgba(30, 64, 175, 0.4);
    }
    .room-voice-btn.active {
      border-color: rgba(248, 113, 113, 0.65);
      color: #fecaca;
      background: rgba(153, 27, 27, 0.35);
    }
    .room-badge {
      min-width: 20px;
      height: 20px;
      border-radius: 999px;
      padding: 0 6px;
      background: rgba(96, 165, 250, 0.18);
      color: #dbeafe;
      font-size: 11px;
      font-weight: 700;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .room-badge.mention {
      background: rgba(244, 63, 94, 0.25);
      color: #ffd3dc;
    }
    .room-call-indicator {
      border: 1px solid rgba(34, 197, 94, 0.55);
      border-radius: 999px;
      background: rgba(22, 163, 74, 0.2);
      color: #86efac;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.3px;
      padding: 2px 7px;
      text-transform: uppercase;
      white-space: nowrap;
    }
    .room-call-indicator.denied {
      border-color: rgba(251, 113, 133, 0.6);
      background: rgba(190, 24, 93, 0.2);
      color: #fecdd3;
    }

    .room-item:hover {
      color: var(--text);
      border-color: var(--line);
      background: rgba(18, 26, 49, 0.9);
      transform: translateX(1px);
    }

    .room-item.active {
      color: #dbeafe;
      border-color: rgba(96, 165, 250, 0.46);
      background: linear-gradient(135deg, rgba(30, 64, 175, 0.35), rgba(30, 64, 175, 0.16));
    }
    .room-item.has-unread:not(.active) {
      color: var(--text);
      border-color: var(--line-strong);
    }
    .room-item.has-mention:not(.active) {
      border-color: rgba(244, 63, 94, 0.45);
      box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.2) inset;
    }

    .status-row {
      padding: 12px 14px;
      border-top: 1px solid var(--line);
      color: var(--muted);
      font-size: 13px;
    }
    .status-text {
      min-height: 18px;
    }
    .theme-row {
      margin-top: 8px;
      display: flex;
      align-items: center;
      gap: 8px;
      color: #cbd5e1;
      font-size: 11px;
    }
    .theme-row select {
      flex: 1;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--control-bg);
      color: var(--text);
      font: inherit;
      font-size: 12px;
      padding: 4px 8px;
    }
    .theme-row select option {
      background: var(--panel-solid);
      color: var(--text);
    }

    .chat {
      display: grid;
      grid-template-rows: auto 1fr auto;
      grid-template-columns: minmax(0, 1fr) 340px;
      min-height: 0;
      overflow: hidden;
    }

    .chat-head {
      grid-column: 1 / -1;
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      gap: 12px;
      padding: 14px 16px;
      border-bottom: 1px solid var(--line);
      background: linear-gradient(180deg, rgba(96, 165, 250, 0.08), rgba(96, 165, 250, 0));
    }

    .chat-title {
      margin: 0;
      font-size: 18px;
      font-weight: 700;
    }

    .chat-sub {
      margin: 3px 0 0;
      color: var(--muted);
      font-size: 12px;
      letter-spacing: 0.35px;
    }
    .pinned-banner {
      grid-column: 1 / -1;
      margin: 10px 12px 0;
      border: 1px solid rgba(56, 189, 248, 0.3);
      border-radius: 10px;
      background: rgba(8, 47, 73, 0.25);
      padding: 8px 10px;
      display: flex;
      align-items: center;
      gap: 8px;
      color: #dbeafe;
      font-size: 12px;
    }
    .pinned-banner .pin-title {
      color: #7dd3fc;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.3px;
      flex-shrink: 0;
    }
    .pinned-banner .pin-text {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      opacity: 0.95;
    }
    .pinned-banner .pin-jump {
      margin-left: auto;
      flex-shrink: 0;
      border: 1px solid rgba(56, 189, 248, 0.45);
      border-radius: 8px;
      background: rgba(15, 23, 42, 0.75);
      color: #bae6fd;
      font-size: 11px;
      font-weight: 700;
      padding: 5px 8px;
      cursor: pointer;
    }
    .pinned-banner .pin-jump:hover {
      background: rgba(14, 116, 144, 0.35);
      color: #fff;
    }
    .search-bar {
      grid-column: 1 / -1;
      margin: 8px 12px 0;
      padding: 8px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--panel-2);
      display: grid;
      grid-template-columns: minmax(0, 1fr) 150px 145px auto auto auto;
      gap: 6px;
      align-items: center;
    }
    .search-bar input,
    .search-bar select {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--control-bg);
      color: var(--text);
      font: inherit;
      font-size: 12px;
      padding: 6px 8px;
    }
    .search-meta {
      color: var(--muted);
      font-size: 11px;
      justify-self: end;
      white-space: nowrap;
    }

    .chat-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-self: end;
      align-items: center;
    }
    .dm-call-actions {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .desktop-only {
      display: inline-flex;
    }
    .mobile-only {
      display: none !important;
    }
    .settings-wrap {
      position: relative;
      display: inline-flex;
      align-items: center;
    }
    .settings-menu {
      position: absolute;
      top: 34px;
      right: 0;
      min-width: 140px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--panel-solid);
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
      padding: 4px;
      z-index: 8;
    }
    .settings-menu button {
      width: 100%;
      text-align: left;
      border: 0;
      background: transparent;
      color: var(--text);
      font: inherit;
      font-size: 13px;
      border-radius: 8px;
      padding: 7px 8px;
      cursor: pointer;
    }
    .settings-menu button:hover {
      background: rgba(244, 63, 94, 0.2);
    }
    .modal {
      position: fixed;
      inset: 0;
      z-index: 4000;
      background: var(--modal-overlay);
      display: grid;
      place-items: center;
      padding: 18px;
    }
    .modal-card {
      width: min(560px, 100%);
      border: 1px solid var(--line);
      border-radius: 14px;
      background: var(--panel-solid);
      box-shadow: 0 18px 48px rgba(0,0,0,0.45);
      padding: 12px;
      display: grid;
      gap: 10px;
    }
    .modal-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .modal-title {
      margin: 0;
      font-size: 16px;
    }
    .notify-grid {
      display: grid;
      gap: 8px;
      max-height: 44vh;
      overflow-y: auto;
    }
    .notify-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 130px;
      gap: 8px;
      align-items: center;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--control-bg-soft);
      padding: 7px 8px;
    }
    .notify-row select {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--control-bg);
      color: var(--text);
      font: inherit;
      font-size: 12px;
      padding: 5px 7px;
    }
    .toggle-inline {
      display: inline-flex;
      gap: 8px;
      align-items: center;
      color: var(--text);
      font-size: 12px;
    }
    .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }
    .create-channel-label {
      color: var(--muted);
      font-size: 12px;
      font-weight: 600;
    }
    .create-channel-input {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--control-bg);
      color: var(--text);
      font: inherit;
      font-size: 14px;
      padding: 9px 10px;
    }
    .create-channel-input:focus {
      outline: none;
      border-color: var(--line-strong);
      box-shadow: 0 0 0 1px var(--line-strong);
    }
    .create-channel-error {
      color: #fca5a5;
      font-size: 12px;
      min-height: 16px;
    }
    .chat-switch {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      justify-self: center;
      border: 1px solid rgba(34, 211, 238, 0.36);
      border-radius: 12px;
      padding: 4px;
      background: rgba(8, 17, 36, 0.9);
      box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.16) inset;
    }
    .chat-switch.off {
      visibility: hidden;
      pointer-events: none;
    }

    .btn {
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #0f1630;
      color: var(--text);
      padding: 9px 12px;
      font-family: inherit;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: 120ms ease;
    }

    .btn:hover { transform: translateY(-1px); border-color: var(--line-strong); }
    .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
    .btn.primary { background: var(--btn-primary-bg); border-color: var(--btn-primary-border); }
    .btn.success { background: linear-gradient(145deg, #15803d, #16a34a); border-color: rgba(110, 231, 183, 0.5); }
    .btn.danger { background: linear-gradient(145deg, #b91c1c, #dc2626); border-color: rgba(252, 165, 165, 0.55); }
    .btn.warn { background: linear-gradient(145deg, #be123c, #e11d48); border-color: rgba(251, 113, 133, 0.55); }
    .btn.icon-only {
      width: 38px;
      height: 38px;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .btn.icon-only svg {
      width: 18px;
      height: 18px;
      stroke: currentColor;
      stroke-width: 1.9;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
      display: block;
    }

    .messages {
      grid-column: 1 / 2;
      grid-row: 2 / 3;
      padding: 12px;
      overflow-y: auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
      gap: 8px;
      background:
        linear-gradient(transparent 0, var(--transcript-overlay) 100%),
        repeating-linear-gradient(180deg, var(--transcript-stripe) 0, var(--transcript-stripe) 1px, transparent 1px, transparent 38px);
    }
    .jump-latest {
      grid-column: 1 / 2;
      justify-self: end;
      margin: -42px 16px 0 0;
      z-index: 5;
      border-radius: 999px;
      padding: 8px 12px;
    }
    .screens {
      grid-column: 1 / 2;
      grid-row: 2 / 3;
      border-bottom: 0;
      background: rgba(7, 11, 24, 0.88);
      padding: 10px;
      display: grid;
      gap: 10px;
      grid-template-rows: auto 1fr;
      min-height: 0;
      overflow: hidden;
    }
    .screens-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 0 2px;
      flex-wrap: wrap;
    }
    .screens-summary {
      color: #cbd5e1;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.25px;
    }
    .screens-grid {
      min-height: 0;
      overflow-y: auto;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      align-content: start;
    }
    .screens-grid.count-1 {
      grid-template-columns: 1fr;
    }
    .screens-empty {
      grid-column: 1 / -1;
      border: 1px dashed rgba(143, 174, 255, 0.3);
      border-radius: 12px;
      color: var(--muted);
      font-size: 13px;
      padding: 14px;
      text-align: center;
    }
    .screen-card {
      border: 1px solid rgba(143, 174, 255, 0.2);
      border-radius: 12px;
      overflow: hidden;
      background: #070c18;
    }
    .screen-card.presenter-card {
      border-color: color-mix(in srgb, var(--warn) 58%, var(--line) 42%);
      box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 36%, transparent);
    }
    .screen-media-wrap {
      position: relative;
      width: 100%;
      min-height: 120px;
      background: #000;
    }
    .web-overlay-card {
      display: grid;
      grid-template-rows: auto auto minmax(260px, 1fr);
      min-height: 0;
    }
    .web-overlay-toolbar {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 8px;
      border-bottom: 1px solid rgba(143, 174, 255, 0.16);
      background: rgba(9, 14, 28, 0.86);
      flex-wrap: wrap;
    }
    .web-overlay-toolbar input[type="text"] {
      flex: 1;
      min-width: 220px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--control-bg);
      color: var(--text);
      font: inherit;
      font-size: 12px;
      padding: 6px 8px;
    }
    .web-overlay-toolbar input[type="color"] {
      width: 32px;
      height: 30px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: transparent;
      padding: 2px;
      cursor: pointer;
    }
    .web-overlay-toolbar input[type="range"] {
      width: 88px;
      accent-color: var(--range-accent);
    }
    .web-overlay-stage {
      position: relative;
      min-height: 260px;
      background: #02060f;
    }
    .web-overlay-frame,
    .web-overlay-canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      border: 0;
      display: block;
    }
    .web-overlay-canvas {
      z-index: 2;
    }
    .presenter-overlay-canvas {
      position: absolute;
      inset: 0;
      z-index: 3;
      pointer-events: none;
    }
    .screen-card.span-2 {
      grid-column: 1 / -1;
    }
    .screen-head {
      padding: 8px 10px;
      color: #dbeafe;
      font-size: 12px;
      font-weight: 700;
      border-bottom: 1px solid rgba(143, 174, 255, 0.16);
      background: rgba(15, 24, 45, 0.85);
    }
    .screen-head-inner {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }
    .screen-head-title {
      min-width: 0;
    }
    .screen-quality-controls {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin-left: auto;
      max-width: 100%;
    }
    .screen-quality-label {
      font-size: 11px;
      color: var(--muted);
      font-weight: 700;
      white-space: nowrap;
    }
    .screen-quality-select {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--control-bg);
      color: var(--text);
      font: inherit;
      font-size: 12px;
      padding: 4px 8px;
      max-width: min(56vw, 280px);
    }
    .screen-draw-controls {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      margin-left: 8px;
      max-width: 100%;
    }
    .screen-draw-color {
      width: 30px;
      height: 28px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: transparent;
      padding: 1px;
      cursor: pointer;
    }
    .screen-draw-size {
      width: 92px;
      accent-color: var(--range-accent);
    }
    .screen-card.presenter-card .screen-head {
      color: color-mix(in srgb, var(--warn) 74%, var(--text) 26%);
      border-bottom-color: color-mix(in srgb, var(--warn) 35%, var(--line) 65%);
      background: color-mix(in srgb, var(--warn) 18%, var(--panel) 82%);
    }
    .screens-grid .screen-card video {
      display: block;
      width: 100%;
      max-height: 32vh;
      object-fit: contain;
      background: #000;
    }
    .screens-grid.count-1 .screen-card video {
      max-height: 68vh;
    }
    .messages.drag-over {
      outline: 2px dashed rgba(96, 165, 250, 0.6);
      outline-offset: -6px;
      background:
        linear-gradient(transparent 0, var(--transcript-overlay) 100%),
        var(--transcript-drag-tint);
    }

    .msg {
      border: 1px solid rgba(143, 174, 255, 0.12);
      border-radius: 12px;
      background: rgba(14, 20, 38, 0.82);
      padding: 10px 12px;
      width: 100%;
      max-width: 100%;
      animation: fadeIn 140ms ease;
      position: relative;
    }
    .msg-emoji-btn {
      position: absolute;
      top: 8px;
      right: 36px;
      border: 1px solid rgba(148, 163, 184, 0.45);
      border-radius: 999px;
      background: rgba(15, 23, 42, 0.92);
      color: #cbd5e1;
      font-size: 14px;
      width: 26px;
      height: 26px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      opacity: 0;
      pointer-events: none;
      transition: opacity 120ms ease;
    }
    .msg:hover .msg-emoji-btn,
    .msg-emoji-btn.open {
      opacity: 1;
      pointer-events: auto;
    }
    .msg-emoji-btn:hover {
      border-color: rgba(125, 211, 252, 0.6);
      color: #fff;
      background: rgba(8, 47, 73, 0.55);
    }
    .msg.mention {
      border-color: rgba(250, 204, 21, 0.55);
      background: rgba(120, 53, 15, 0.2);
      box-shadow: inset 3px 0 0 rgba(250, 204, 21, 0.75);
    }
    .mention-token {
      color: #fde68a;
      background: rgba(250, 204, 21, 0.16);
      border-radius: 4px;
      padding: 0 3px;
      font-weight: 700;
    }
    .msg-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .msg .meta {
      display: flex;
      align-items: baseline;
      gap: 8px;
      font-size: 12px;
      color: var(--muted);
      margin-bottom: 5px;
    }
    .date-separator {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 8px 0 2px;
      color: var(--muted);
      font-size: 11px;
      letter-spacing: 0.2px;
      text-transform: uppercase;
    }
    .date-separator::before,
    .date-separator::after {
      content: "";
      height: 1px;
      flex: 1;
      background: rgba(143, 174, 255, 0.18);
    }
    .msg .author {
      font-weight: 700;
      font-size: 13px;
    }
    .presence-dot {
      width: 8px;
      height: 8px;
      border-radius: 999px;
      display: inline-block;
      margin-right: 4px;
      box-shadow: 0 0 0 2px rgba(8, 12, 24, 0.85);
      vertical-align: middle;
    }
    .presence-dot.online { background: #22c55e; }
    .presence-dot.idle { background: #f59e0b; }
    .presence-dot.offline { background: #64748b; }
    .new-separator {
      border-top: 1px solid rgba(244, 63, 94, 0.45);
      margin: 8px 0 2px;
      position: relative;
      height: 0;
    }
    .new-separator span {
      position: absolute;
      top: -8px;
      left: 10px;
      background: #0b1020;
      padding: 0 6px;
      color: #fda4af;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.25px;
    }
    .msg .time {
      color: var(--muted);
      font-size: 11px;
      letter-spacing: 0.2px;
    }
    .edited-badge {
      display: inline-flex;
      align-items: center;
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 1px 6px;
      font-size: 10px;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }
    .msg-actions {
      position: relative;
    }
    .msg-menu-btn {
      border: 1px solid transparent;
      background: transparent;
      color: var(--muted);
      border-radius: 8px;
      width: 24px;
      height: 24px;
      cursor: pointer;
      font-size: 16px;
      line-height: 20px;
      padding: 0;
    }
    .msg-menu-btn:hover {
      border-color: var(--line);
      color: var(--text);
      background: rgba(96, 165, 250, 0.1);
    }
    .msg-menu {
      position: absolute;
      top: 28px;
      right: 0;
      min-width: 120px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--panel-solid);
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
      padding: 4px;
      z-index: 5;
    }
    .msg-menu.up {
      top: auto;
      bottom: 28px;
    }
    .msg-menu button {
      width: 100%;
      text-align: left;
      border: 0;
      background: transparent;
      color: var(--text);
      font: inherit;
      font-size: 13px;
      border-radius: 8px;
      padding: 7px 8px;
      cursor: pointer;
    }
    .msg-menu button:hover {
      background: var(--control-bg-soft);
    }
    .msg-menu .danger:hover {
      background: rgba(244, 63, 94, 0.2);
    }
    .msg-menu .warn:hover {
      background: rgba(234, 179, 8, 0.2);
    }
    .msg-menu .accent:hover {
      background: rgba(34, 197, 94, 0.2);
    }
    .user-action-menu {
      right: auto;
      top: auto;
      min-width: 86px;
      width: fit-content;
      max-width: 120px;
      z-index: 300;
    }
    .user-action-menu button {
      white-space: nowrap;
      padding: 6px 10px;
      font-size: 12px;
    }
    .reply-ref {
      border-left: 3px solid rgba(96, 165, 250, 0.5);
      background: rgba(96, 165, 250, 0.09);
      border-radius: 8px;
      padding: 7px 9px;
      margin-bottom: 8px;
      font-size: 12px;
      cursor: pointer;
    }
    .reply-ref .name {
      color: #bfdbfe;
      font-weight: 700;
      margin-bottom: 2px;
    }
    .msg-inline-edit {
      display: grid;
      gap: 8px;
      margin-top: 4px;
    }
    .msg-inline-edit textarea {
      width: 100%;
      min-height: 72px;
      max-height: 180px;
      resize: vertical;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--control-bg);
      color: var(--text);
      font: inherit;
      padding: 8px 10px;
    }
    .msg-inline-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }
    .reply-ref .text {
      color: var(--muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .msg .body {
      line-height: 1.45;
      word-break: break-word;
    }
    .msg .body code {
      background: rgba(143, 174, 255, 0.12);
      border: 1px solid rgba(143, 174, 255, 0.2);
      border-radius: 6px;
      padding: 1px 6px;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 12px;
    }
    .msg .body a {
      color: #93c5fd;
      text-decoration: none;
      border-bottom: 1px dashed rgba(147, 197, 253, 0.5);
    }
    .msg .body a:hover { color: #dbeafe; }
    .embed {
      margin-top: 10px;
      border: 1px solid rgba(143, 174, 255, 0.22);
      border-radius: 10px;
      overflow: hidden;
      background: #0a1020;
    }
    .embed iframe {
      display: block;
      width: 100%;
      max-width: 480px;
      aspect-ratio: 16 / 9;
      border: 0;
    }
    .embed video {
      display: block;
      width: min(100%, 520px);
      max-height: 300px;
      background: #000;
    }
    .embed img {
      display: block;
      width: min(100%, 520px);
      max-height: 420px;
      object-fit: contain;
      background: #0a1020;
    }
    .file-attach {
      margin-top: 8px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 7px 9px;
      background: rgba(96, 165, 250, 0.08);
      color: #dbeafe;
      text-decoration: none;
      font-size: 12px;
    }
    .reactions {
      margin-top: 8px;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 6px;
    }
    .reaction-chip {
      border: 1px solid rgba(96, 165, 250, 0.25);
      border-radius: 999px;
      padding: 3px 8px;
      background: rgba(17, 24, 39, 0.75);
      color: #cbd5e1;
      font-size: 12px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      user-select: none;
    }
    .reaction-chip:hover {
      border-color: rgba(125, 211, 252, 0.55);
      background: rgba(8, 47, 73, 0.35);
      color: #e0f2fe;
    }
    .reaction-chip.mine {
      border-color: rgba(34, 197, 94, 0.5);
      background: rgba(22, 163, 74, 0.2);
      color: #dcfce7;
      font-weight: 700;
    }
    .thread-indicator {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: rgba(56, 189, 248, 0.14);
      color: var(--text);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.2px;
      padding: 4px 9px;
      cursor: pointer;
      transition: 120ms ease;
    }
    .thread-indicator:hover {
      border-color: var(--line-strong);
      background: rgba(56, 189, 248, 0.24);
      transform: translateY(-1px);
    }
    .thread-indicator .count {
      color: var(--accent);
      font-weight: 800;
    }
    .thread-indicator.inline {
      margin-left: 8px;
      font-size: 10px;
      padding: 2px 7px;
      letter-spacing: 0.15px;
      vertical-align: middle;
    }
    .emoji-picker {
      position: fixed;
      z-index: 3000;
      width: 260px;
      border: 1px solid rgba(143, 174, 255, 0.28);
      border-radius: 12px;
      background: #0b1224;
      box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
      padding: 8px;
    }
    .emoji-picker-grid {
      display: grid;
      grid-template-columns: repeat(8, minmax(0, 1fr));
      gap: 4px;
    }
    .emoji-option {
      border: 1px solid transparent;
      border-radius: 8px;
      background: transparent;
      color: #e2e8f0;
      font-size: 18px;
      line-height: 1;
      padding: 6px 0;
      cursor: pointer;
    }
    .emoji-option:hover {
      border-color: rgba(125, 211, 252, 0.45);
      background: rgba(30, 64, 175, 0.26);
    }
    .embed .tiktok-embed {
      margin: 0;
      max-width: 360px;
      min-width: 280px;
    }

    .composer {
      grid-column: 1 / 2;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      padding: 12px;
      border-top: 1px solid var(--line);
      background: rgba(10, 14, 28, 0.85);
    }
    .side-rail {
      grid-column: 2 / 3;
      grid-row: 2 / 4;
      border-left: 1px solid var(--line);
      background: rgba(8, 13, 28, 0.88);
      display: grid;
      grid-template-rows: minmax(180px, 1fr) minmax(0, 1fr);
      min-height: 0;
    }
    .members-panel {
      min-height: 0;
      display: grid;
      grid-template-rows: auto 1fr;
      border-bottom: 1px solid var(--line);
    }
    .members-head {
      padding: 10px 12px;
      border-bottom: 1px solid var(--line);
      color: #dbeafe;
      font-size: 13px;
      font-weight: 700;
    }
    .member-list {
      overflow-y: auto;
      padding: 8px;
      display: grid;
      gap: 6px;
      align-content: start;
    }
    .member-row {
      display: flex;
      align-items: center;
      gap: 8px;
      border: 1px solid rgba(143, 174, 255, 0.14);
      border-radius: 9px;
      background: rgba(13, 20, 38, 0.75);
      padding: 7px 8px;
      min-width: 0;
    }
    .member-name {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: #dbeafe;
      font-size: 12px;
    }
    .member-sub {
      margin-left: auto;
      color: var(--muted);
      font-size: 11px;
      white-space: nowrap;
    }
    .member-sub.voice {
      color: #99f6e4;
      border: 1px solid rgba(20, 184, 166, 0.5);
      border-radius: 999px;
      padding: 2px 7px;
      background: rgba(20, 184, 166, 0.16);
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.2px;
    }
    .member-sub.online {
      color: #4ade80;
      font-weight: 700;
    }

    .composer textarea {
      flex: 1;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #0c1226;
      color: var(--text);
      padding: 11px 12px;
      font-family: inherit;
      font-size: 14px;
      min-height: 44px;
      max-height: 180px;
      resize: none;
      overflow-y: auto;
    }
    .content-toggle {
      min-width: 88px;
      border-color: rgba(34, 211, 238, 0.32);
      background: rgba(11, 22, 45, 0.92);
      color: #c7d2fe;
      padding: 8px 12px;
    }
    .content-toggle.active {
      background: var(--toggle-active-bg);
      border-color: var(--toggle-active-border);
      color: #fff;
      box-shadow: 0 8px 20px var(--toggle-active-shadow);
    }
    .voice-advanced.off { display: none; }
    .voice-settings-toggle {
      border: 1px solid var(--line);
      border-radius: 999px;
      background: rgba(96, 165, 250, 0.08);
      color: #c7d2fe;
      font-size: 11px;
      font-weight: 700;
      padding: 4px 8px;
      cursor: pointer;
      margin-top: 4px;
      width: fit-content;
    }
    .typing-indicator {
      flex-basis: 100%;
      order: 4;
      color: var(--muted);
      font-size: 12px;
      min-height: 18px;
      margin-top: 2px;
    }
    .mention-suggest {
      flex-basis: 100%;
      order: 3;
      border: 1px solid rgba(143, 174, 255, 0.24);
      border-radius: 10px;
      background: rgba(10, 16, 32, 0.96);
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
      padding: 4px;
      display: grid;
      gap: 2px;
      max-height: 180px;
      overflow-y: auto;
    }
    .mention-item {
      border: 1px solid transparent;
      border-radius: 8px;
      background: transparent;
      color: #cbd5e1;
      text-align: left;
      font: inherit;
      font-size: 13px;
      padding: 7px 9px;
      cursor: pointer;
    }
    .mention-item.active,
    .mention-item:hover {
      border-color: rgba(125, 211, 252, 0.45);
      background: rgba(30, 64, 175, 0.26);
      color: #fff;
    }
    .upload-progress {
      grid-column: 1 / -1;
      height: 6px;
      border: 1px solid var(--line);
      border-radius: 999px;
      overflow: hidden;
      background: rgba(10, 14, 28, 0.7);
    }
    .upload-progress .fill {
      height: 100%;
      width: 0;
      background: linear-gradient(90deg, #22d3ee, #3b82f6);
      transition: width 120ms linear;
    }
    .composer-attachments {
      order: -1;
      flex-basis: 100%;
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin: 0 0 2px 0;
    }
    .attach-chip {
      position: relative;
      width: 92px;
      height: 92px;
      border: 1px solid var(--line);
      border-radius: 12px;
      overflow: hidden;
      background: #0b1122;
    }
    .attach-chip img {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
    }
    .attach-chip .upload-meta {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      background: linear-gradient(180deg, rgba(4,6,12,0), rgba(4,6,12,0.88));
      color: #dbeafe;
      font-size: 10px;
      padding: 10px 6px 4px;
      text-align: center;
      letter-spacing: 0.2px;
    }
    .attach-chip .upload-bar {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      height: 3px;
      background: rgba(148, 163, 184, 0.3);
    }
    .attach-chip .upload-bar > span {
      display: block;
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #22d3ee, #3b82f6);
    }
    .attach-chip.error {
      border-color: rgba(251, 113, 133, 0.55);
    }
    .attach-chip.file {
      width: auto;
      min-width: 180px;
      height: auto;
      padding: 8px 10px;
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      align-items: center;
      color: #dbeafe;
      font-size: 12px;
    }
    .attach-chip.file .label {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      max-width: 280px;
    }
    .file-link {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-top: 8px;
      color: #dbeafe;
      text-decoration: none;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 7px 10px;
      background: rgba(96, 165, 250, 0.08);
      max-width: min(100%, 560px);
    }
    .file-link .name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .attach-chip button {
      position: absolute;
      top: 4px;
      right: 4px;
      width: 20px;
      height: 20px;
      border: 1px solid rgba(255, 255, 255, 0.18);
      border-radius: 999px;
      background: rgba(4, 8, 20, 0.82);
      color: #d4defd;
      cursor: pointer;
      padding: 0 0 1px 0;
      font: inherit;
      line-height: 18px;
      font-weight: 700;
      text-align: center;
    }
    .attach-chip button:hover {
      background: rgba(4, 8, 20, 0.96);
      color: #ffffff;
    }
    .lightbox {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.82);
      display: grid;
      place-items: center;
      z-index: 9999;
      padding: 20px;
    }
    .lightbox img {
      max-width: min(92vw, 1400px);
      max-height: 90vh;
      object-fit: contain;
      border-radius: 12px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    }

    .voice {
      display: grid;
      grid-template-rows: auto auto auto;
      overflow: hidden;
      min-height: 0;
    }
    .voice-inline {
      border: 1px solid var(--line);
      border-radius: 12px;
      background: rgba(13, 18, 34, 0.8);
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior: contain;
      min-height: 0;
      max-height: min(56vh, 420px);
    }
    .voice-inline .voice-head {
      padding: 12px 12px 10px;
    }
    .voice-inline .voice-controls {
      padding: 10px;
    }
    .voice-inline .voice-meta {
      padding: 10px 12px;
    }
    .voice-inline .voice-meters {
      display: none;
    }
    .voice-inline .voice-meter-row {
      grid-template-columns: 98px 1fr 86px;
      padding: 7px;
    }
    .voice-devices {
      display: grid;
      gap: 6px;
      margin-top: 6px;
    }
    .voice-devices select {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #0b1224;
      color: #dbeafe;
      font: inherit;
      font-size: 12px;
      padding: 6px 8px;
    }
    .voice-toggle-row {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 6px;
    }
    .voice-pill {
      border: 1px solid var(--line);
      border-radius: 999px;
      background: rgba(96, 165, 250, 0.1);
      color: #dbeafe;
      font-size: 11px;
      font-weight: 700;
      padding: 4px 8px;
      cursor: pointer;
    }
    .voice-pill.active {
      background: rgba(34, 197, 94, 0.2);
      border-color: rgba(34, 197, 94, 0.45);
      color: #bbf7d0;
    }
    .voice-pill.off {
      background: rgba(71, 85, 105, 0.2);
      border-color: rgba(100, 116, 139, 0.42);
      color: #cbd5e1;
    }
    .thread-panel {
      display: grid;
      grid-template-rows: auto 1fr auto;
      min-height: 0;
    }
    .thread-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      padding: 10px 12px;
      border-bottom: 1px solid var(--line);
    }
    .thread-title {
      margin: 0;
      font-size: 13px;
      color: var(--text);
      font-weight: 700;
    }
    .thread-list {
      overflow-y: auto;
      padding: 10px;
      display: grid;
      gap: 8px;
      align-content: start;
    }
    .thread-item {
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--control-bg-soft);
      padding: 8px;
      font-size: 12px;
    }
    .thread-item .meta {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      margin-bottom: 4px;
    }
    .thread-item .meta .author {
      font-weight: 700;
    }
    .thread-item .meta .time {
      color: var(--muted);
    }
    .thread-compose {
      border-top: 1px solid var(--line);
      padding: 8px;
      display: grid;
      gap: 6px;
    }
    .thread-compose textarea {
      width: 100%;
      min-height: 60px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--control-bg);
      color: var(--text);
      font: inherit;
      font-size: 12px;
      padding: 7px 8px;
      resize: vertical;
    }

    .voice-head {
      padding: 16px;
      border-bottom: 1px solid var(--line);
      background: linear-gradient(180deg, rgba(94, 234, 212, 0.1), rgba(94, 234, 212, 0));
    }

    .voice-title {
      margin: 0;
      font-size: 17px;
      font-weight: 700;
    }

    .voice-sub {
      margin: 3px 0 0;
      font-size: 12px;
      color: var(--muted);
    }

    .voice-controls {
      padding: 12px;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
      border-bottom: 1px solid var(--line);
    }

    .voice-meta {
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
      font-size: 13px;
      color: var(--muted);
      display: grid;
      gap: 5px;
    }
    .voice-status-state {
      font-weight: 700;
    }
    .voice-status-state.online {
      color: #22c55e;
    }
    .voice-status-state.offline {
      color: #93a4c4;
    }
    .volume-row {
      display: grid;
      grid-template-columns: 48px 1fr 42px;
      align-items: center;
      gap: 8px;
      margin-top: 2px;
    }
    .volume-row input[type="range"] {
      width: 100%;
      accent-color: var(--range-accent);
    }
    .volume-row .pct {
      text-align: right;
      color: #c7d2fe;
      font-size: 12px;
    }

    .voice-meters {
      display: none;
    }

    .voice-meter-row {
      display: grid;
      grid-template-columns: 132px 1fr 86px;
      gap: 8px;
      align-items: center;
      background: rgba(16, 22, 39, 0.75);
      border: 1px solid rgba(143, 174, 255, 0.13);
      border-radius: 10px;
      padding: 8px;
    }
    .voice-meter-row.speaking {
      border-color: rgba(34, 197, 94, 0.55);
      box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.22);
    }
    .voice-meter-row.speaking .voice-meter-name {
      color: #bbf7d0;
      font-weight: 700;
    }

    .voice-meter-name {
      font-size: 12px;
      color: var(--muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .voice-meter-track {
      height: 12px;
      border: 1px solid var(--line);
      border-radius: 999px;
      overflow: hidden;
      background: #090f21;
      position: relative;
    }

    .voice-meter-fill {
      position: absolute;
      inset: 0 auto 0 0;
      width: 0%;
      background: linear-gradient(90deg, #22d3ee 0%, #22c55e 65%, #fde047 100%);
      transition: width 85ms linear;
    }
    .voice-meter-vol {
      display: grid;
      gap: 2px;
    }
    .voice-meter-vol input[type="range"] {
      width: 100%;
      accent-color: var(--range-accent);
    }
    .voice-meter-vol .pct {
      text-align: right;
      color: #c7d2fe;
      font-size: 11px;
      line-height: 1;
    }

    .status-ok { color: var(--ok); }
    .status-warn { color: var(--warn); }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    @media (max-width: 1200px) {
      .app-shell { grid-template-columns: 260px minmax(0, 1fr); }
    }

    @media (max-width: 880px) {
      body { overflow: hidden; }
      .app-shell {
        height: 100dvh;
        min-height: 100dvh;
        grid-template-columns: 1fr;
        grid-template-rows: minmax(116px, 24vh) minmax(0, 1fr);
      }
      .channels { order: 1; min-height: 0; }
      .chat { order: 2; min-height: 0; height: 100%; }
      .channels-head {
        padding: 10px 12px 8px;
      }
      .mobile-channels-toggle {
        display: inline-flex;
      }
      .mobile-only {
        display: inline-flex !important;
      }
      .desktop-only {
        display: none !important;
      }
      .workspace {
        font-size: 15px;
      }
      .workspace-sub {
        display: none;
      }
      .room-list-wrap {
        padding: 8px;
        gap: 6px;
        grid-template-rows: minmax(0, 1fr) auto;
      }
      .room-list-head {
        margin-bottom: 6px;
      }
      .room-list-title {
        font-size: 11px;
      }
      .channel-bubble .room-list-head {
        padding: 8px 8px 6px;
      }
      .channel-bubble .room-list {
        padding: 6px;
      }
      .room-item {
        padding: 7px 8px;
        font-size: 13px;
      }
      .status-row {
        display: none;
      }
      .chat-head {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 8px 10px;
      }
      .chat-head > div:first-child {
        width: 100%;
        min-width: 0;
      }
      .chat-title {
        font-size: 16px;
      }
      .chat-sub {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .chat-actions {
        margin-left: auto;
        justify-self: end;
        display: inline-flex;
        flex-wrap: nowrap;
        gap: 6px;
      }
      .app-shell.mobile-channels-collapsed {
        grid-template-rows: auto minmax(0, 1fr);
      }
      .app-shell.mobile-channels-collapsed .room-list-wrap {
        display: none;
      }
      .app-shell.mobile-in-voice:not(.mobile-channels-collapsed) {
        grid-template-rows: minmax(150px, 33vh) minmax(0, 1fr);
      }
      .app-shell.mobile-in-voice:not(.mobile-channels-collapsed) .room-list-wrap {
        grid-template-rows: minmax(0, 1fr) auto;
      }
      .chat-switch {
        order: 2;
      }
      .search-bar {
        margin: 6px 8px 0;
        grid-template-columns: 1fr 1fr;
      }
      .search-bar .search-meta {
        grid-column: 1 / -1;
        justify-self: start;
      }
      .chat-actions .btn {
        padding: 6px 9px;
        font-size: 12px;
      }
      .chat { grid-template-columns: 1fr; }
      .messages {
        padding: 8px;
      }
      .pinned-banner {
        margin: 8px 8px 0;
        padding: 6px 8px;
      }
      .composer {
        gap: 6px;
        padding: 8px;
      }
      .composer textarea {
        flex-basis: 100%;
        font-size: 16px;
        min-height: 38px;
        max-height: 120px;
      }
      .composer .btn.primary {
        padding: 8px 10px;
      }
      .typing-indicator {
        font-size: 11px;
        min-height: 14px;
        margin-top: 0;
      }
      .side-rail {
        display: none;
      }
      .thread-panel {
        max-height: 34vh;
      }
      .channel-bubble .room-list { max-height: none; }
      .voice-inline .voice-meters {
        display: none;
      }
      .voice-inline .voice-head {
        padding: 8px 8px 6px;
      }
      .voice-inline .voice-controls {
        padding: 6px 8px;
      }
      .voice-inline .voice-meta {
        padding: 6px 8px;
      }
      .screens-grid {
        grid-template-columns: 1fr !important;
      }
      .screen-card.span-2 {
        grid-column: auto;
      }
    }
