/* The shared shell owns navigation; child pages keep their existing forms. */
html[data-workspace-frame="1"] body.layout-app {
    margin: 0; padding: 16px; width: 100%; max-width: none; min-height: 0;
}
html[data-workspace-frame="1"] body > .app-navigation,
html[data-workspace-frame="1"] body > .global-back-navigation { display: none !important; }
body.workspace-shell {
    display: flex; flex-direction: column; height: 100vh; height: 100dvh;
    max-width: none; margin: 0; padding: 8px; overflow: hidden;
}
body.workspace-shell > .global-back-navigation { display: none; }
body.workspace-shell > .app-navigation { flex: none; max-height: 32vh; max-height: 32dvh; overflow-y: auto; margin-bottom: 8px; }
#finance-workspace { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.workspace-toolbar { display: flex; align-items: stretch; gap: 6px; flex: none; margin-bottom: 6px; }
.workspace-tablist { display: flex; flex: 1; min-width: 0; gap: 4px; overflow-x: auto; padding: 3px; }
.workspace-tab { display: flex; flex: none; align-items: stretch; border: 1px solid #ccd6e5; border-radius: 7px 7px 0 0; background: #f3f6fa; }
.workspace-tab.is-active { background: #fff; border-bottom: 3px solid #2563eb; }
.workspace-tab button, .workspace-refresh { background: transparent; color: #29405c; border: 0; border-radius: 4px; box-shadow: none; font: inherit; cursor: pointer; }
.workspace-tab button { padding: 8px; margin: 0; min-height: 40px; }
.workspace-tab-label { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-tab-close { min-width: 34px; padding-left: 4px !important; }
.workspace-refresh { flex: none; width: 42px; font-size: 24px; border: 1px solid #ccd6e5; }
.workspace-tab button:focus-visible, .workspace-refresh:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.workspace-pages { position: relative; display: flex; flex: 1; min-height: 0; min-width: 0; border: 1px solid #d7dde7; border-radius: 6px; background: #fff; overflow: hidden; }
.workspace-pages iframe { width: 100%; height: 100%; border: 0; display: block; flex: 1; min-width: 0; background: #f9f9f9; }
.workspace-pages iframe[hidden], .workspace-status[hidden] { display: none !important; }
.workspace-status { flex: none; margin: 2px 0 8px; color: #6b4200; background: #fff7e2; padding: 8px; border-radius: 5px; }
.workspace-loading { position: absolute; z-index: 1; top: 20px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid #e0e6ee; border-radius: 20px; background: #fff; color: #526479; font-size: 14px; line-height: 20px; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 8px #29405c0a; }
.workspace-loading[hidden] { display: none !important; }
.workspace-loading-spinner { width: 15px; height: 15px; flex: none; border: 2px solid #e0e7f0; border-top-color: #3976ce; border-radius: 50%; animation: workspace-spin .8s linear infinite; }
@keyframes workspace-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .workspace-loading-spinner { animation: none; } }
#finance-workspace .workspace-tablist {
    flex: 1 1 0; width: 0; overflow-y: hidden;
    /* Keep native overlay scrollbars below labels, close buttons and drag grips.
       The ID scope also wins over the brand theme's padding: 0. */
    padding-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: #a7adb3 #ececeb;
}
@supports selector(::-webkit-scrollbar) {
    #finance-workspace .workspace-tablist { scrollbar-width: auto; }
    #finance-workspace .workspace-tablist::-webkit-scrollbar { height: 6px; }
    #finance-workspace .workspace-tablist::-webkit-scrollbar-track { background: #ececeb; }
    #finance-workspace .workspace-tablist::-webkit-scrollbar-thumb { background: #a7adb3; border-radius: 3px; }
    #finance-workspace .workspace-tablist::-webkit-scrollbar-thumb:hover { background: #858c94; }
}
#finance-workspace .workspace-tab { max-width: min(280px, 70vw); min-width: 0; }
#finance-workspace .workspace-tab button { width: auto; min-width: 0; margin: 0; border: 0; box-shadow: none; position: static; }
#finance-workspace .workspace-tab-label { display: block; text-align: left; flex: 1 1 auto; min-width: 0; max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#finance-workspace .workspace-tab-close { flex: none; width: 34px; min-width: 34px; }
#finance-workspace .workspace-refresh { width: 42px; min-width: 42px; margin: 0; }
.workspace-menu-toggle { display: none; }
@media (max-width: 1179px) {
    body.workspace-shell > .nav-dropdown-menu.nav-dropdown-menu--desktop-flyout { position: fixed; display: flex; flex-direction: column; gap: 2px; width: calc(100% - 24px); min-width: 0; max-width: none; margin: 0; padding: 8px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; z-index: 1200; }
    body.workspace-shell > .nav-dropdown-menu--desktop-flyout > a { display: flex; align-items: center; min-height: 44px; padding: 8px 10px; border-radius: 4px; color: #2255aa; text-decoration: none; font-size: 15px; white-space: normal; }
    body.workspace-shell > .nav-dropdown-menu--desktop-flyout > a:hover { background: #eef4ff; }
    body.workspace-shell > .nav-dropdown-menu--desktop-flyout > a:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
    body.workspace-shell > .workspace-menu-toggle { display: block; flex: none; align-self: flex-start; width: auto; min-width: 0; margin: 0 0 6px; padding: 7px 12px; }
    body.workspace-shell.workspace-menu-collapsed > .app-navigation { display: none; }
}
@media (min-width: 1180px) {
    body.layout-app.workspace-shell { padding: 10px 12px 12px 192px; }
    body.workspace-shell > .app-navigation { max-height: none; }
}
@media (max-width: 640px) {
    html[data-workspace-frame="1"] body.layout-app { padding: 10px; }
    .workspace-tab-label { max-width: 185px; }
}
@media print {
    body.workspace-shell > .app-navigation, .workspace-toolbar, .workspace-status, .workspace-loading, body.workspace-shell > .nav-dropdown-menu--desktop-flyout { display: none !important; }
}

[data-task-navigation] [data-task-counter][hidden] { display: none !important; }

[data-task-tag] { max-width: 100%; white-space: normal; overflow-wrap: anywhere; vertical-align: middle; background: #eef4ff; color: #29405c; }

/* Reserve real layout space for counter text and its 4px outer ring. */
.app-navigation [data-task-navigation] > summary,
.app-navigation a[data-task-navigation] { column-gap: 10px; }
.app-navigation [data-task-navigation] .nav-notifications-badge { flex: 0 0 auto; }
.app-navigation [data-task-navigation] > summary::after { margin-left: 0; }
.nav-dropdown-menu [data-task-counter] { margin-inline-start: 8px; flex: 0 0 auto; }

/* Authored flex styles must respect the unread counter hidden state. */
.app-navigation .nav-notifications-badge[hidden] { display: none !important; }

/* Attachment previews retain the source document, draft, files and scroll. */
.workspace-attachment-preview { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px; background: #182538b3; }
.workspace-attachment-panel { display: flex; flex-direction: column; width: 1100px; max-width: 100%; height: 92vh; height: 92dvh; min-height: 0; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 12px 50px #0004; }
.workspace-attachment-toolbar { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 12px; border-bottom: 1px solid #d7dde7; background: #fff; color: #29405c; }
body.workspace-shell .workspace-attachment-close { width: auto; min-height: 44px; margin: 0; padding: 8px 12px; flex: none; }
.workspace-attachment-title { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.workspace-attachment-toolbar a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: #2255aa; }
.workspace-attachment-content { display: flex; flex: 1; min-height: 0; min-width: 0; align-items: center; justify-content: center; background: #f3f5f8; overflow: auto; }
.workspace-attachment-content img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.workspace-attachment-content iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.workspace-attachment-error { padding: 20px; color: #6b4200; }
@media (max-width: 640px) {
    .workspace-attachment-preview { padding: 8px; }
    .workspace-attachment-panel { height: calc(100vh - 16px); height: calc(100dvh - 16px); }
    .workspace-attachment-title { order: 3; flex-basis: 100%; }
    .workspace-attachment-toolbar { gap: 4px 10px; }
}
@media print { .workspace-attachment-preview { display: none !important; } }

/* Only the controls move; live document frames keep their DOM and files. */
#finance-workspace .workspace-tab .workspace-tab-move { flex:none; width:23px; min-width:23px; padding:2px !important; color:#8493a8; cursor:grab; touch-action:none; user-select:none; -webkit-user-select:none; }
#finance-workspace .workspace-tab--dragging { opacity:.65; }
#finance-workspace .workspace-tab--dragging .workspace-tab-move { cursor:grabbing; }
#finance-workspace .workspace-drop-before { box-shadow:inset 3px 0 #2563eb; }
#finance-workspace .workspace-drop-after { box-shadow:inset -3px 0 #2563eb; }
@media(max-width:640px){#finance-workspace .workspace-tab .workspace-tab-move{width:44px;min-width:44px;min-height:44px;}}
