/* Exact sizes for the Classic themes (Dark, Ash, Onyx, Light and custom non-terminal themes).
   The page sets html.ui-classic for those themes; System24 and Liquid Glass never get this class, so they keep their own look.
   Every number below is a measured size (default density), noted where it is not obvious:
   server list 72px wide with 40px icons, 375px sidebar (72 + 302 channel list + 1px border), 264px member list,
   49px headers, floating 56px account panel, 72px message gutter, 56px message box, 8px menus and 32px menu rows.
   Phones and narrow windows (860px and below) keep the existing mobile layout untouched. */

@media (min-width: 861px) {
  html:root.ui-classic {
    --cx-rail: 72px;
    --cx-guild: 40px;
    --cx-side: 302px;          /* The default sidebar is 375px including the 72px server list and a 1px border */
    --cx-members: 264px;
    --cx-head: 49px;           /* 48px bar + 1px bottom border */
    --cx-panel-gap: 8px;
  }
  @media (max-width: 1199px) { html:root.ui-classic { --cx-side: 240px; --cx-members: 240px; } }

  /* ---------- server list ---------- */
  html:root.ui-classic .rail { width: var(--cx-rail); padding: 4px 0 0; gap: 8px; }
  html:root.ui-classic #servers-container { gap: 8px; }
  html:root.ui-classic .rail-btn { width: var(--cx-guild); height: var(--cx-guild); border-radius: 12px; font-size: 12px; font-weight: 500; }
  html:root.ui-classic .rail-btn:hover, html:root.ui-classic .rail-btn.active { border-radius: 12px; }
  html:root.ui-classic .rail-btn .rail-logo { width: var(--cx-guild); height: var(--cx-guild); border-radius: 12px; }
  html:root.ui-classic .rail-btn.action .ico { width: 20px; height: 20px; }
  /* the white pill: 4px wide at the very left edge; 8px unread, 20px hover, 40px selected */
  html:root.ui-classic .rail-btn::before { left: -16px; width: 4px; border-radius: 0 4px 4px 0; }
  html:root.ui-classic .rail-btn:hover::before { height: 20px; }
  html:root.ui-classic .rail-btn.unread::before { height: 8px; }
  html:root.ui-classic .rail-btn.active::before { height: 40px; }
  html:root[dir="rtl"].ui-classic .rail-btn::before { left: auto; right: -16px; border-radius: 4px 0 0 4px; }
  html:root.ui-classic .rail-sep { width: 32px; height: 1px; border-radius: 1px; }
  html:root.ui-classic .badge { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 12px; font-weight: 700; right: -4px; bottom: -4px; border-width: 4px; }

  /* ---------- channel list ---------- */
  html:root.ui-classic .channels-pane { width: var(--cx-side); }
  html:root.ui-classic .pane-header { height: var(--cx-head); min-height: var(--cx-head); padding: 8px 16px; box-shadow: none; }
  html:root.ui-classic .server-title-btn { font-size: 16px; font-weight: 600; line-height: 20px; gap: 4px; }
  html:root.ui-classic #server-header-container.has-banner { height: auto !important; }
  html:root.ui-classic .channels-pane > .section-header { font-size: 12px; font-weight: 600; letter-spacing: .02em; line-height: 16px; height: 40px; padding: 16px 8px 0 16px; align-items: center; }
  html:root.ui-classic .channel-list { padding: 0 8px 8px; gap: 2px; }
  html:root.ui-classic .list-label { font-size: 12px; font-weight: 600; letter-spacing: .02em; line-height: 16px; margin: 0; padding: 16px 8px 4px 0; height: auto; min-height: 40px; box-sizing: border-box; align-items: flex-end; }
  html:root.ui-classic .cat-label { gap: 2px; }
  html:root.ui-classic .cat-arrow svg { width: 12px; height: 12px; }
  html:root.ui-classic .channel-item { min-height: 32px; height: auto; padding: 4px 8px; gap: 8px; border-radius: 8px; font-size: 16px; font-weight: 500; line-height: 24px; }
  html:root.ui-classic .channel-item > span:first-child { gap: 8px; }
  html:root.ui-classic .channel-item .ch-ic { width: 20px; height: 20px; margin-inline-end: 0; vertical-align: middle; align-items: center; justify-content: center; }
  html:root.ui-classic .channel-item .ch-ic svg, html:root.ui-classic .channel-item .ch-ic .ic { width: 20px; height: 20px; }
  html:root.ui-classic .voice-member-subitem { padding: 4px 8px 4px 36px; font-size: 14px; line-height: 18px; border-radius: 8px; min-height: 32px; }
  html:root.ui-classic .voice-member-subitem .user-avatar { width: 24px !important; height: 24px !important; }

  /* ---------- account panel: a floating card over the bottom of the server list and channel list ---------- */
  html:root.ui-classic .channels-pane { position: relative; overflow: visible; z-index: 31; }
  html:root.ui-classic .rail { padding-bottom: calc(var(--cx-panels-h, 56px) + var(--cx-panel-gap) * 2); }
  html:root.ui-classic .channels-pane > :is(.game-dock, .voice-connected-dock, .user-status-bar) {
    margin-inline: calc(var(--cx-panel-gap) - var(--cx-rail)) var(--cx-panel-gap);
    background: var(--bg-0); border: 1px solid var(--border); border-top-width: 0; border-radius: 0; position: relative; z-index: 2;
  }
  html:root.ui-classic .channels-pane > :is(.game-dock, .voice-connected-dock):not(:empty) { padding: 12px; }
  html:root.ui-classic .channels-pane > .dc-first { border-top-width: 1px; border-top-left-radius: 8px; border-top-right-radius: 8px; }
  html:root.ui-classic .channels-pane > .user-status-bar { height: 56px; padding: 0 8px; margin-bottom: var(--cx-panel-gap); border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; gap: 8px; }
  html:root.ui-classic .user-pill { gap: 8px; padding: 5px 4px; border-radius: 4px; }
  html:root.ui-classic #current-user-avatar { width: 32px !important; height: 32px !important; font-size: 12px !important; }
  html:root.ui-classic #current-user-name { font-size: 14px; font-weight: 600; line-height: 18px; }
  html:root.ui-classic #current-user-role { font-size: 12px; line-height: 16px; }
  html:root.ui-classic .user-quick-controls { gap: 0; }
  html:root.ui-classic .user-status-bar .quick-icon-btn { width: 32px; height: 32px; border-radius: 8px; }
  html:root.ui-classic .user-status-bar .quick-icon-btn .vi { width: 20px; height: 20px; }

  /* ---------- chat header: 49px, 20px icons in 32px buttons, 8px apart; it runs on over the member list like other apps's ---------- */
  html:root.ui-classic .main-header { height: var(--cx-head); min-height: var(--cx-head); padding: 8px 8px 8px 16px; gap: 8px; box-shadow: none; position: relative; z-index: 21; background: var(--bg-2); }
  html:root.ui-classic .app:has(> .members-pane:not(.hidden-pane)) .main-header { margin-inline-end: calc(var(--cx-members) * -1); }
  html:root.ui-classic .app:has(> .members-pane:not(.hidden-pane)) .members-pane > .section-header { display: none; }
  html:root.ui-classic .app:has(> .members-pane:not(.hidden-pane)) .members-pane { padding-top: var(--cx-head); }
  html:root.ui-classic #chat-title-heading { font-size: 16px; font-weight: 600; line-height: 20px; }
  html:root.ui-classic .channel-topic-text { font-size: 14px; line-height: 18px; }
  html:root.ui-classic .main-header .icon-btn { min-width: 32px; width: 32px; height: 32px; border-radius: 8px; }
  html:root.ui-classic .main-header .icon-btn svg, html:root.ui-classic .main-header .icon-btn .ico, html:root.ui-classic .main-header .icon-btn .ic { width: 20px; height: 20px; }
  html:root.ui-classic #chat-search-input { width: 244px; height: 32px; padding: 0 8px; font-size: 14px; border-radius: 8px; }
  html:root.ui-classic #chat-search-input:focus { width: 244px; }

  /* ---------- messages: 16px gutters, 40px avatar, text starts 72px in ---------- */
  html:root.ui-classic .msg { gap: 16px; padding: 2px 48px 2px 16px; margin-top: 17px; --msg-gap: 16px; }
  html:root.ui-classic .msg.grouped { margin-top: 0; }
  html:root.ui-classic .msg-avatar { padding-top: 2px; }
  html:root.ui-classic .msg-gutter { width: 40px; font-size: 11px; padding-top: 0; line-height: 22px; }
  html:root.ui-classic .msg-head { gap: 4px; align-items: baseline; line-height: 22px; }
  html:root.ui-classic .msg-author { font-size: 16px; font-weight: 500; line-height: 22px; }
  html:root.ui-classic .msg-time { font-size: 12px; line-height: 22px; margin-inline-start: 4px; }
  html:root.ui-classic .msg-text { font-size: calc(var(--msg-fs, 13px) + 3px); line-height: 1.375; }
  html:root.ui-classic .msg-tools { right: 16px; top: -16px; border-radius: 8px; }

  /* ---------- message box: 8px from the sides and bottom, 56px tall, 8px corners ---------- */
  html:root.ui-classic .composer-wrap { padding: 0 8px 8px; }
  html:root.ui-classic .composer { min-height: 56px; padding: 0 6px 0 4px; gap: 8px; border-radius: 8px; align-items: center; }
  html:root.ui-classic #chat-input { font-size: 16px; line-height: 22px; padding: 17px 0; min-height: 56px; box-sizing: border-box; }
  html:root.ui-classic .composer .icon-btn { min-width: 32px; width: 32px; height: 32px; border-radius: 8px; }
  html:root.ui-classic .composer .icon-btn .ico, html:root.ui-classic .composer .icon-btn svg { width: 20px; height: 20px; }
  /* other apps pulls the message box up over the last 16px of chat and shows "is typing" there, so the box keeps its 8px bottom gap */
  html:root.ui-classic .composer-wrap .typing-indicator { position: absolute; left: 16px; right: 16px; top: -20px; height: 20px; padding: 0 4px; line-height: 20px; pointer-events: none; }
  html:root.ui-classic #reply-bar { margin: 0; border-radius: 8px 8px 0 0; padding: 8px 16px; font-size: 14px; }

  /* ---------- member list ---------- */
  html:root.ui-classic .members-pane { width: var(--cx-members); padding-bottom: 10px; }
  html:root.ui-classic .member-group { font-size: 12px; font-weight: 600; letter-spacing: .02em; line-height: 16px; padding: 20px 4px 4px 16px; }
  html:root.ui-classic .member-row { margin: 0 8px; padding: 4px 8px; min-height: 42px; gap: 12px; border-radius: 8px; box-sizing: border-box; }
  html:root.ui-classic .member-row > .user-avatar { width: 32px !important; height: 32px !important; }
  html:root.ui-classic .member-row .mname { font-size: 16px; font-weight: 500; line-height: 20px; }
  html:root.ui-classic .member-row .msub { font-size: 12px; line-height: 16px; }
}

/* ======================= settings, menus, dialogs, buttons, inputs ======================= */
@media (min-width: 861px) {
  /* settings: other apps's full-window layer. The sidebar grows from 218px and right-aligns its 192px list; the content grows from
     800px with a 740px column, and the round close button stays 21px to the right of that column, 60px from the top */
  html:root.ui-classic dialog.fullscreen { background: var(--bg-2); backdrop-filter: none; align-items: stretch; justify-content: stretch; }
  html:root.ui-classic dialog.fullscreen .settings-shell { width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; box-shadow: none; animation: none; }
  html:root.ui-classic dialog.fullscreen .settings-nav { flex: 1 0 218px; width: auto; min-width: 0; max-width: none; align-items: flex-end; padding: 60px 6px 60px 20px; background: var(--bg-1); border-inline-end: 0; }
  html:root.ui-classic dialog.fullscreen .settings-nav-inner { width: 192px; gap: 0; }
  html:root.ui-classic dialog.fullscreen .snav { font-size: 16px; font-weight: 500; line-height: 20px; padding: 6px 10px; margin-bottom: 2px; border-radius: 4px; min-height: 32px; box-sizing: border-box; }
  html:root.ui-classic dialog.fullscreen .snav.active::before { display: none; }
  html:root.ui-classic dialog.fullscreen .snav-group { font-size: 12px; font-weight: 700; line-height: 16px; letter-spacing: .02em; padding: 6px 10px; }
  html:root.ui-classic dialog.fullscreen .snav-sep { height: 1px; margin: 8px 10px; }
  html:root.ui-classic dialog.fullscreen #settings-search { margin: 0 0 8px; width: 100%; }
  html:root.ui-classic dialog.fullscreen .settings-body { flex: 1 1 800px; display: flex; align-items: flex-start; padding: 60px 40px 80px; border-radius: 0; background: var(--bg-2); }
  html:root.ui-classic dialog.fullscreen .settings-content { flex: 1 1 auto; max-width: 740px; min-width: 0; }
  html:root.ui-classic dialog.fullscreen .settings-close {
    order: 2; position: sticky; top: 0; inset-inline: auto; flex: none; margin-inline-start: 21px;
    width: 36px; height: 36px; border-width: 2px; font-size: 16px;
  }
  html:root.ui-classic dialog.fullscreen .settings-close small { display: block; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 8px; font-size: 13px; font-weight: 600; line-height: 16px; }
  html:root.ui-classic dialog.fullscreen .spanel h2 { font-size: 20px; line-height: 24px; font-weight: 600; margin-bottom: 20px; }

  /* right-click menus: 8px corners and padding, 32px rows with 8px padding, 14px/500 labels, 20px icons, 188-320px wide */
  html:root.ui-classic #ctx-menu { min-width: 188px; max-width: 320px; padding: 8px; border-radius: 8px; border-color: var(--border); }
  html:root.ui-classic .ctx-item { min-height: 32px; padding: 6px 8px; gap: 8px; border-radius: 4px; font-size: 14px; font-weight: 500; line-height: 18px; box-sizing: border-box; }
  html:root.ui-classic .ctx-item svg, html:root.ui-classic .ctx-item .ic { width: 16px; height: 16px; }   /* house size: 32 px rows, 14 px text, 16 px icons */
  html:root.ui-classic .ctx-sep { margin: 4px 8px; }

  /* dialogs: 440px wide, 8px corners, 16px padding, a 20px/600 title and a grey footer strip for the buttons */
  html:root.ui-classic .dialog-box { width: 440px; padding: 16px; border-radius: 8px; border-color: var(--border); }
  html:root.ui-classic .dialog-box.golive { width: min(960px, 96vw); padding: 16px; }   /* the share-screen picker keeps its wide, two-column size */
  html:root.ui-classic .golive .gl-tabs { padding: 4px; border-radius: 8px; margin-bottom: 16px; } html:root.ui-classic .golive .gl-tab { padding: 10px 8px; font-size: 14px; font-weight: 600; border-radius: 6px; }
  html:root.ui-classic .golive .gl-thumb { border-radius: 8px; } html:root.ui-classic .golive .gl-body { gap: 16px 20px; }
  html:root.ui-classic .dialog-box > .panel-label:first-child { font-size: 20px; line-height: 24px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--bright); margin-bottom: 16px; }
  html:root.ui-classic .dialog-box > .dialog-actions:last-child { margin: 16px -16px -16px; padding: 16px; gap: 8px; background: var(--bg-1); border-radius: 0 0 8px 8px; }

  /* buttons: filled, 8px corners, 14px/500. Medium 38px (96px wide at least) in dialogs and footers, small 32px elsewhere */
  html:root.ui-classic .btn { min-height: 32px; min-width: 60px; padding: 2px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; line-height: 16px; border: 0;
    background: var(--accent); color: #fff; box-shadow: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box; }
  html:root.ui-classic .btn:hover:not(:disabled) { background: var(--accent); filter: brightness(.9); color: #fff; }
  html:root.ui-classic .btn-danger { background: #da373c; color: #fff; }
  html:root.ui-classic .btn-danger:hover:not(:disabled) { background: #a12828; filter: none; }
  html:root.ui-classic .btn-success { background: #248046; color: #fff; }
  html:root.ui-classic .btn-success:hover:not(:disabled) { background: #1a6334; filter: none; }
  html:root.ui-classic .dialog-actions .btn { min-height: 38px; min-width: 96px; }
  /* other apps's grey "Cancel": a red-outlined cancel button that only closes the dialog becomes the secondary grey one */
  html:root.ui-classic .dialog-actions .btn-danger:first-child:not(:last-child) { background: rgba(127,127,140,.24); color: var(--bright); }
  html:root.ui-classic .dialog-actions .btn-danger:first-child:not(:last-child):hover { background: rgba(127,127,140,.34); }

  /* text boxes: 40px tall, 8px corners, 16px text */
  html:root.ui-classic .system-input:not(textarea), html:root.ui-classic select.system-input { min-height: 40px; padding: 0 12px; border-radius: 8px; font-size: 16px; box-sizing: border-box; }
  html:root.ui-classic textarea.system-input { padding: 10px 12px; border-radius: 8px; font-size: 16px; line-height: 22px; }
  html:root.ui-classic .field-group label, html:root.ui-classic .field-label { font-size: 12px; font-weight: 700; letter-spacing: .02em; line-height: 16px; margin-bottom: 0; }
  html:root.ui-classic .field-group { gap: 8px; margin-bottom: 20px; }
}
@media (min-width: 861px) {
  /* other apps confirms with its blurple primary button, not green */
  html:root.ui-classic :is(.dialog-actions, dialog.fullscreen) .btn-success { background: var(--accent); }
  html:root.ui-classic :is(.dialog-actions, dialog.fullscreen) .btn-success:hover:not(:disabled) { background: var(--accent); filter: brightness(.9); }
}
@media (min-width: 861px) {
  /* call screen: other apps's control bar. Each section is a raised strip (1px border, 12px corners, 4px padding, 8px gap),
     12px between sections, 40x40 buttons with 8px corners and 20px icons, carets as 20px nubs attached to their button,
     and a red disconnect button as tall as a section */
  html:root.ui-classic .voice-floating-bar { gap: 12px; bottom: 16px; }
  html:root.ui-classic .voice-floating-bar .vc-group { gap: 8px; padding: 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-1); }
  html:root.ui-classic .voice-floating-bar .vc-group .control-pill-btn { width: 40px; height: 40px; padding: 10px; border-radius: 8px; }
  html:root.ui-classic .voice-floating-bar .vi { width: 20px; height: 20px; }
  html:root.ui-classic .voice-floating-bar .vc-split { display: flex; align-items: stretch; gap: 0; border-radius: 8px; }
  html:root.ui-classic .voice-floating-bar .vc-split .control-pill-btn { border-radius: 8px 0 0 8px; }
  html:root.ui-classic .voice-floating-bar .vc-caret { width: 20px; height: 40px; padding: 10px 2px; border-radius: 0 8px 8px 0; display: flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; }
  html:root.ui-classic .voice-floating-bar .vc-caret:hover { background: rgba(127,127,140,.16); color: var(--bright); }
  html:root.ui-classic .voice-floating-bar .control-pill-btn.danger-leave { width: 56px; height: 50px; padding: 0; border-radius: 12px; background: #da373c; color: #fff; }
  html:root.ui-classic .voice-floating-bar .control-pill-btn.danger-leave:hover { background: #a12828; }
  html:root.ui-classic .voice-floating-bar .control-pill-btn.danger-leave .vi { width: 24px; height: 24px; }

  /* tiles: 8px corners and 8px gaps, the name label 12px in from the corner with 6px 12px padding and 8px corners */
  html:root.ui-classic #stage-members { gap: 8px; }
  html:root.ui-classic #voice-call-screen .tile { border-radius: 8px; }
  html:root.ui-classic #voice-call-screen .tile .tile-label { left: 12px; bottom: 12px; padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; line-height: 18px; background: rgba(0,0,0,.6); }
  html:root[dir="rtl"].ui-classic #voice-call-screen .tile .tile-label { left: auto; right: 12px; }
  html:root.ui-classic .vc-corner { width: 40px; height: 40px; border-radius: 8px; }
  html:root.ui-classic .vc-corner .vi { width: 24px; height: 24px; }
}

@media (min-width: 861px) {
  /* share-screen picker: lighter selected tab, plain Cancel (the picker is dismissed with Esc or a click outside) */
  html:root.ui-classic .golive .gl-tabs { background: var(--bg-0); border-color: transparent; }
  html:root.ui-classic .golive .gl-tab.on { background: var(--bg-4, #35363c); color: var(--bright); }
  html:root.ui-classic .golive .gl-foot .btn { background: transparent; border-color: transparent; color: var(--text); }
  html:root.ui-classic .golive .gl-foot .btn:hover { background: var(--bg-3); color: var(--bright); }
  /* names on call tiles: a small dark chip, 14px semibold (people tiles and the stream tile) */
  html:root.ui-classic #voice-call-screen .tile:not(.vl-small-x) > .tile-label, html:root.ui-classic #voice-call-screen .stream-user-overlay { font-size: 14px; font-weight: 600; line-height: 20px; padding: 4px 10px; border-radius: 6px; left: 12px; bottom: 12px; background: rgba(0,0,0,.62); }
}
