/* Shared navigation controls for workspaces, editors, authentication and previews. */
html body .ui-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    margin: 0;
}
html body .ui-navigation :is(.ui-navigation__back, .ui-navigation__home) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    gap: 8px;
    width: auto;
    min-width: 44px;
    min-height: 40px;
    height: auto;
    max-width: 100%;
    margin: 0;
    padding: 8px 12px;
    position: static;
    border: 1px solid var(--ui-color-line);
    border-radius: var(--ui-radius-sm);
    background: var(--ui-color-surface);
    color: var(--ui-color-primary-strong);
    box-shadow: none;
    font: 800 12px/1.5 var(--ui-font-family);
    text-decoration: none;
    white-space: normal;
    text-align: start;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
html body .ui-navigation .ui-navigation__home { flex: 0 0 40px; padding: 8px; }
html body .ui-navigation [hidden] { display: none !important; }
/* The application exposes logout on the dashboard; hidden child-page forms
   must not reappear as inert buttons through legacy form layout rules. */
html body .topbar .logout-form[hidden] { display: none !important; }
html body .ui-navigation a:hover { background: var(--ui-color-row-hover); border-color: var(--ui-color-primary); }
html body .ui-navigation a:focus-visible { outline: 3px solid var(--ui-color-accent); outline-offset: 3px; }
html body .ui-navigation a::before, html body .ui-navigation a::after { content: none; }
html body .ui-navigation .ui-icon { width: 18px; height: 18px; flex: 0 0 18px; }
html body .ui-navigation__label { display: inline; min-width: 0; overflow-wrap: anywhere; color: inherit; font: inherit; }
html body .ui-navigation-row {
    box-sizing: border-box;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    min-width: 0;
    padding: 8px 14px;
    background: var(--ui-color-surface-soft);
    border-bottom: 1px solid var(--ui-color-line);
}
html body .ui-navigation-row .ui-navigation { margin-inline-end: auto; }
html body.auth-page .ui-navigation { justify-content: center; margin-top: 16px; }
html body :is(.contract-shell, .invoice-shell, .certificate-app, .editor-tool-page > .app):has(> .ui-navigation-row) {
    grid-template-rows: 48px auto minmax(0, 1fr);
}
html body :is(.contract-header, .invoice-header, .app-header, .header):has(+ .ui-navigation-row) { padding-inline: 14px; }
html body .preview-toolbar .ui-navigation { display: inline-flex; }
html body .preview-toolbar:has(> .ui-navigation) { height: auto; min-height: 52px; padding: 6px 12px; box-sizing: border-box; flex-wrap: wrap; }
@media (max-width: 768px) {
    html body .ui-navigation :is(.ui-navigation__back, .ui-navigation__home) { min-height: 44px; }
    html body .ui-navigation { width: 100%; }
    html body .ui-navigation__back { flex: 1 1 auto; justify-content: flex-start; }
    html body .ui-navigation-row { padding: 7px 10px; }
    html body .preview-toolbar { flex-wrap: wrap; }
}
@media print {
    html body .ui-navigation, html body .ui-navigation-row { display: none !important; }
}
