/* The board path has a fixed physical position, independent of UI language. */
/* Favorites opens above the tools rail and workspace menus; dialogs remain modal. */
body .favorite-boards-panel { z-index: 13000; }
body .modal-backdrop { z-index: 13010; }
.workspace-search-btn { display: flex; align-items: center; justify-content: space-between; gap: 9px; width: 184px; height: 34px; padding: 0 12px; border: 1px solid var(--theme-border, #d9dde1); border-radius: 10px; background: transparent; color: var(--topbar-ink, #323b4a); font: 400 12px/1 var(--ui-font, Arial), sans-serif; cursor: pointer; direction: ltr; box-sizing: border-box; }
.workspace-search-btn>span:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
html[lang=ar] .workspace-search-btn>span:first-child { direction: rtl; text-align: right; }
.workspace-search-icon { width: 15px; height: 15px; flex: 0 0 15px; background: currentColor; -webkit-mask: url('icon.php?n=search&v=2.4.0') center/contain no-repeat; mask: url('icon.php?n=search&v=2.4.0') center/contain no-repeat; }
.workspace-search-btn:hover { background: var(--theme-hover, #edf0f1); }
.workspace-search-btn:focus-visible { outline: 2px solid var(--theme-accent, #4c6686); outline-offset: 1px; }
.workspace-menu-divider { height: 1px; margin: 6px 4px; background: var(--theme-border, #dfe3e6); }
.workspace-menu-heading { display: block; padding: 5px 8px 3px; font: 600 11px/1.4 var(--ui-font, Arial), sans-serif; color: var(--theme-muted, #666d7a); text-align: start; }
#board-menu .board-menu-icon { fill: currentColor; stroke: none; }
.topbar .board-menu-icon circle { fill: currentColor; stroke: none; }
@media (max-width: 1000px) { .workspace-search-btn { width: 148px; } }
@media (min-width: 701px) {
  body:not(.hn-mobile) { --hn-header-height: 88px; }
  body:not(.hn-mobile) .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 320px) minmax(0, 1fr) !important;
    grid-template-rows: 42px 45px;
    align-items: center;
    column-gap: 12px !important;
    row-gap: 0 !important;
    direction: ltr !important;
    height: var(--hn-header-height) !important;
    min-height: var(--hn-header-height) !important;
    padding: 0 16px !important;
  }
  body:not(.hn-mobile) .topbar .board-heading {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    top: 3px;
    justify-content: flex-start !important;
    justify-self: start;
    width: 100%;
    min-width: 0 !important;
    max-width: none !important;
    direction: ltr !important;
    overflow: hidden;
  }
  body:not(.hn-mobile) .topbar .folder-up-btn {
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
  }
  body:not(.hn-mobile) .topbar .breadcrumbs {
    flex: 0 1 auto !important;
    gap: 10px !important;
    direction: ltr !important;
    min-width: 0;
    overflow: auto hidden;
    scrollbar-width: none;
  }
  body:not(.hn-mobile) .topbar .breadcrumbs::-webkit-scrollbar { display: none; }
  body:not(.hn-mobile) .topbar .breadcrumb-item { gap: 10px; }
  body:not(.hn-mobile) .topbar .breadcrumb-color { width: 16px; min-width: 16px; height: 16px; border-radius: 4px; }
  body:not(.hn-mobile) .topbar :is(.breadcrumb-btn, .board-title) {
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 28px !important;
  }
  body:not(.hn-mobile) .topbar .breadcrumb-current-label,
  body:not(.hn-mobile) .topbar .breadcrumb-item.current .board-title {
    color: var(--topbar-muted, #8d929a) !important;
  }
  /* Keep Arabic glyphs beside their icon; dir=auto still shapes their text. */
  body:not(.hn-mobile) .topbar :is(.breadcrumb-btn, .breadcrumb-item.current .board-title) { text-align: left !important; }
  body:not(.hn-mobile) .topbar .breadcrumb-item.current .board-title { min-width: 20px !important; }
  body:not(.hn-mobile) .topbar .breadcrumb-separator { color: var(--topbar-muted, #a5a9ae) !important; }
  body:not(.hn-mobile) .topbar-board-name {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
    display: block;
    max-width: min(320px, 31vw);
    overflow: hidden;
    color: var(--topbar-ink, #323b4a);
    font: 600 23px/1.25 var(--ui-font, Arial), sans-serif;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  body:not(.hn-mobile) .topbar-center-tools {
    grid-column: 2 / 4;
    grid-row: 1;
    position: relative;
    top: 3px;
    justify-content: flex-start !important;
    justify-self: end;
    min-width: 0;
    align-items: center;
    gap: 10px !important;
    direction: rtl;
  }
  body:not(.hn-mobile) .topbar-center-tools .scene-selection-menu:has(.selection-tools.hidden) { display: none; }
  body:not(.hn-mobile) .topbar .scene-selection-menu > .selection-tools:not(.hidden) {
    position: fixed !important;
    top: calc(var(--hn-header-height) + 8px) !important;
    right: 16px !important;
    bottom: auto !important;
    left: auto !important;
    max-height: calc(100dvh - var(--hn-header-height) - 20px) !important;
    overflow-y: auto !important;
  }
  body:not(.hn-mobile) .topbar-actions {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    align-self: center;
    gap: 4px !important;
    direction: rtl;
  }
  body:not(.hn-mobile) .topbar .search-wrap { flex: none; }
  body:not(.hn-mobile) .topbar-actions > .icon-btn,
  body:not(.hn-mobile) .topbar-actions > details > summary {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
  }
  body:not(.hn-mobile) .topbar-actions #project-settings { order: 1; }
  body:not(.hn-mobile) .topbar-actions #favorite-boards-btn { order: 2; }
  body:not(.hn-mobile) .topbar-actions #export-menu-btn { order: 4; }
  body:not(.hn-mobile) .topbar-actions #board-menu-btn { order: 5; }
  body:not(.hn-mobile) .topbar-actions #redo-btn { order: 6; margin-inline-start: 8px; }
  body:not(.hn-mobile) .topbar-actions #undo-btn { order: 7; }
  body:not(.hn-mobile) .topbar-actions #project-settings { position: relative; }
  body:not(.hn-mobile) .topbar-actions #project-settings .project-settings-menu {
    position: fixed !important;
    top: calc(var(--hn-header-height) + 8px) !important;
    right: 16px !important;
    left: auto !important;
  }
  body:not(.hn-mobile) .topbar .zoom-controls { height: 34px !important; padding: 1px !important; }
  body:not(.hn-mobile) .topbar .zoom-controls button { height: 30px !important; }
  body:not(.hn-mobile) #board-menu,
  body:not(.hn-mobile) #export-menu { top: calc(var(--hn-header-height) + 8px) !important; max-height: calc(100dvh - var(--hn-header-height) - 16px); }
  body:not(.hn-mobile) .project-start-screen { inset: var(--hn-header-height) 0 0; }
  body:not(.hn-mobile) .toast-region { top: calc(var(--hn-header-height) + 10px); }
}
@media (min-width: 701px) and (max-width: 1000px) {
  body:not(.hn-mobile) .topbar { grid-template-columns: minmax(0, 1fr) auto !important; }
  body:not(.hn-mobile) .topbar-center-tools { grid-column: 2; }
  body:not(.hn-mobile) .topbar-board-name { grid-column: 1 / -1; max-width: min(320px, calc(100vw - 496px)); font-size: 19px; justify-self: center; }
  body:not(.hn-mobile) .topbar-actions { grid-column: 2; }
  body:not(.hn-mobile) .topbar .search-box { width: 145px !important; }
}
@media (min-width: 701px) and (max-width: 780px) {
  body:not(.hn-mobile) .topbar { padding-inline: 9px !important; column-gap: 10px !important; }
  body:not(.hn-mobile) .topbar .search-box { width: 120px !important; }
  body:not(.hn-mobile) .topbar-actions #project-settings .project-settings-menu { right: 9px !important; }
  body:not(.hn-mobile) .topbar .scene-selection-menu > .selection-tools:not(.hidden) { right: 9px !important; }
}
