/* One global desktop header. Native caption controls remain owned by Windows. */
.graphite-topbar[hidden] { display:none!important; }
body.workspace-design.graphite-interface.graphite-topbar-visible { --graphite-topbar-height:44px; }
body.workspace-design.graphite-interface.graphite-topbar-visible .app,
body.workspace-design.graphite-interface.graphite-topbar-visible .app.sidebar-compact { grid-template-rows:44px minmax(0,1fr) auto; }
body.workspace-design.graphite-interface.graphite-topbar-visible .server-rail { grid-row:2/4; }
body.workspace-design.graphite-interface.graphite-topbar-visible .channel-panel { grid-row:2; }
body.workspace-design.graphite-interface.graphite-topbar-visible .workspace-user { grid-row:3; }
body.workspace-design.graphite-interface.graphite-topbar-visible .main { grid-row:2/4; }
body.workspace-design.graphite-interface.graphite-topbar-visible .workspace-navigation { display:none; }
body.workspace-design.graphite-interface.graphite-topbar-visible .graphite-topbar {
    grid-column:1/-1; grid-row:1; min-width:0; height:44px; display:grid;
    grid-template-columns:auto auto minmax(150px,1fr) auto; align-items:center; gap:16px;
    padding:0 16px; background:var(--bg); color:var(--text); border-bottom:1px solid var(--line);
    -webkit-app-region:drag; user-select:none;
}
body.workspace-design.graphite-interface.graphite-topbar-visible.native-caption-overlay .graphite-topbar { padding-right:max(154px,calc(100vw - env(titlebar-area-width,100vw) + 12px)); }
.graphite-topbar :is(button,a,input,nav) { -webkit-app-region:no-drag; }
body.workspace-design.graphite-interface .graphite-topbar button { border:0; background:transparent; min-height:30px; color:var(--muted); border-radius:7px; }
body.workspace-design.graphite-interface .graphite-topbar button:hover:not(:disabled) { background:var(--panel-soft); color:var(--text); }
body.workspace-design.graphite-interface .graphite-topbar button.graphite-topbar-brand { display:flex; align-items:baseline; gap:5px; padding:2px 0; color:var(--text); white-space:nowrap; }
.graphite-topbar-brand strong { font-size:19px; font-weight:800; letter-spacing:-.6px; }
.graphite-topbar-brand span { font-size:17px; font-weight:400; }
.graphite-topbar-history { display:flex; align-items:center; gap:2px; }
body.workspace-design.graphite-interface .graphite-topbar-history button { display:grid; place-items:center; width:28px; min-height:28px; padding:5px; }
.graphite-topbar-history .interface-icon { width:16px; height:16px; }
body.workspace-design.graphite-interface .graphite-topbar button.graphite-topbar-search {
    width:min(100%,420px); justify-self:center; display:flex; align-items:center; gap:10px; min-width:0;
    height:30px; padding:0 10px; background:var(--panel); border:1px solid var(--line); text-align:left;
}
.graphite-topbar-search>.interface-icon { width:16px; height:16px; }
.graphite-topbar-search>span { flex:1; font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.graphite-topbar-search kbd { font:10px "Segoe UI",sans-serif; opacity:.75; white-space:nowrap; }
.graphite-topbar-tools { display:flex; align-items:center; gap:7px; }
body.workspace-design.graphite-interface .graphite-topbar-tools .graphite-topbar-action,
body.workspace-design.graphite-interface .graphite-topbar-tools #settings-btn { display:grid; place-items:center; width:30px; height:30px; padding:5px; position:relative; }
.graphite-topbar-tools .interface-icon { width:19px; height:19px; }
.graphite-topbar-badge { position:absolute; top:0; right:-2px; display:grid; place-items:center; min-width:14px; height:14px; padding:0 3px; border-radius:6px; font-size:9px; font-weight:700; background:#ed6678; color:#fff; border:2px solid var(--bg); box-sizing:content-box; }
.graphite-topbar-badge[hidden] { display:none; }
body.workspace-design.graphite-interface .graphite-topbar #updates-button.graphite-topbar-update { width:30px; height:30px; min-height:30px; padding:5px; font-size:0; position:relative; border:0; background:transparent; color:var(--muted); box-shadow:none; }
.graphite-topbar-update:before { content:''; display:block; width:19px; height:19px; margin:auto; background:currentColor; mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='M12 3v12m-5-5 5 5 5-5M4 16v5h16v-5'/%3E%3C/svg%3E") center/contain no-repeat; }
body.workspace-design.graphite-interface .graphite-topbar #updates-button.available { color:#072918; background:#49ff8a; box-shadow:0 0 12px #49ff8a44; }
body.workspace-design.graphite-interface.graphite-topbar-visible .server-rail>:is(.inbox-button,button[aria-label="Поиск сообщений"],button[aria-label="Уведомления"]) { display:none; }
body.workspace-design.graphite-interface.graphite-topbar-visible .community-friends>aside { top:var(--graphite-sidebar-top,44px); }
@media(min-width:901px) and (max-width:1250px) {
    body.workspace-design.graphite-interface.graphite-topbar-visible .graphite-topbar { gap:10px; padding-left:12px; }
    .graphite-topbar-tools { gap:4px; }
    .graphite-topbar-search kbd { display:none; }
}
/* Browser/PWA retains its established compact navigation through 1100px. */
@media(max-width:1100px) {
    .browser-client .graphite-topbar { display:none!important; }
    body.browser-client.workspace-design.graphite-interface .community-friends>aside { position:static; width:auto; }
    body.browser-client.workspace-design.graphite-interface:has(.community-friends:not([hidden])) .channel-panel { visibility:visible; }
}
@media(prefers-reduced-motion:reduce) {
    .graphite-topbar button { transition:none; }
}
