/* Fish engineering workspace layout and density. Colors come from shared theme tokens.
   Keep scene, model, permissions and shared component behavior in their owners. */
/* Native controls otherwise fall back to Arial, despite Inter on body. */
body :is(button, input, select, textarea) {
    font-family: var(--font-family);
}

body > header {
    background: var(--bg-secondary) !important;
    box-shadow: none;
}

body > header :is(.home-nav-btn, .icon-btn, .settings-btn) {
    width: 36px;
    height: 36px;
    border-radius: 6px;
}

body > header .actions :is(.icon-btn, .settings-btn):hover {
    background: var(--bg-hover);
    box-shadow: none;
    transform: none;
}

body > .fish-toolbar {
    top: var(--app-header-height);
    min-height: 44px;
    padding: var(--space-1) var(--space-3);
    gap: 6px;
    background: var(--bg-primary);
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
}

.fish-toolbar .toolbar-btn,
.fish-toolbar .wbs-toggle-btn {
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 6px 8px;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

.fish-toolbar .wbs-toggle-btn {
    padding-inline: var(--space-2);
    font-size: var(--toolbar-label-size);
    gap: var(--space-1);
}

.fish-toolbar .toolbar-btn:hover:not(:disabled),
.fish-toolbar .wbs-toggle-btn:hover {
    background: var(--bg-hover);
}

.fish-toolbar .toolbar-btn:focus-visible,
.fish-toolbar .wbs-toggle-btn:focus-visible,
[id='tabsBar'] button:focus-visible,
.right-sidebar button:focus-visible,
.briefcase-open-modal button:focus-visible {
    outline: 1px solid var(--border-hover);
    outline-offset: -1px;
    box-shadow: none;
}

.fish-toolbar .toolbar-divider {
    height: 20px;
    margin: 0 var(--space-1);
}

body > [id='tabsBar'] {
    min-height: 40px;
    background: var(--bg-secondary);
}

/* Access and connection belong in the existing bottom file-status bar. */
#breadcrumb-bar .fish-readonly-banner {
    position: static;
    z-index: auto;
    flex: 0 0 auto;
    min-width: 0;
    max-width: min(440px, 45vw);
    margin: 0;
    padding: 0;
    transform: none;
    overflow: hidden;
    white-space: nowrap;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 12px;
    line-height: 1.2;
}

#breadcrumb-bar .fish-readonly-banner span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

#breadcrumb-bar .fish-readonly-banner .fish-readonly-compact {
    display: none;
}

.fish-readonly-banner[hidden] {
    display: none;
}

#breadcrumb-bar > .fish-file-status {
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(360px, 38vw);
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#breadcrumb-bar > .fish-file-status[data-state='offline'],
#breadcrumb-bar > .fish-file-status[data-state='locked'] {
    color: var(--color-warning-text);
}

#breadcrumb-bar > .fish-file-status[hidden] {
    display: none;
}

#breadcrumb-bar > .file-access-pill-bar--inline {
    flex: 0 1 auto;
    min-width: 0;
    padding: 0;
    margin-left: auto;
    justify-content: flex-end;
    pointer-events: auto;
}

#breadcrumb-bar > .file-access-pill-bar--inline .file-access-pill {
    max-width: min(420px, 42vw);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 12px;
}

#breadcrumb-bar > .file-access-pill-bar--inline .file-access-pill-edit {
    max-height: 34px;
    margin-left: 4px;
}

/* The 3D cue is a secondary control aid, not the title of the document. */
[id='fish3dActionCue'] {
    color: var(--text-secondary);
    font-size: 12px;
}

[id='fish3dActionCue'] .fish3d-action-cue-title {
    font-weight: 500;
}

[id='tabsBar'] .module-tabs-container {
    padding: 0 12px;
    gap: 4px;
}

[id='tabsBar'] .module-tab {
    min-height: 36px;
    padding: var(--space-2) var(--space-3);
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: none;
}

[id='tabsBar'] .module-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

[id='tabsBar'] .module-tab.active {
    background: transparent;
    color: var(--brand-primary-text);
    font-weight: 600;
}

.right-sidebar {
    background: var(--bg-secondary);
    border-left-color: var(--border-primary);
}

.sidebar-section-headline,
.right-sidebar .sidebar-section-header {
    background: var(--bg-secondary);
}

.right-sidebar .sidebar-section-header {
    min-height: 44px;
    padding: 10px 16px;
}

.right-sidebar .sidebar-section-title {
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-secondary);
}

.right-sidebar .sidebar-section-body {
    background: var(--bg-primary);
    padding: 10px 12px;
}

.right-sidebar .layer-item {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    box-shadow: none;
}

.right-sidebar .layer-item.active {
    background: var(--brand-primary-bg);
    border-color: var(--border-primary);
    box-shadow: none;
}

/* The empty prompt belongs to the visible canvas, not the area beneath the inspector. */
.fish-main-container:not(.right-sidebar-collapsed) .fish-canvas-empty {
    left: calc((100% - var(--fish-right-sidebar-width, 340px)) / 2);
    width: min(480px, calc(100% - var(--fish-right-sidebar-width, 340px) - 32px));
}

.fish-canvas-empty .empty-state-text {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.right-sidebar :is(input, select, textarea) {
    font-size: 12.5px;
    color: var(--text-primary);
}

.right-sidebar .geometry-section .form-label {
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 16px;
}

.right-sidebar .geometry-section .form-group {
    margin-bottom: 12px;
}

.right-sidebar .geometry-section .input {
    height: 34px;
    padding: 6px 10px;
    border-radius: var(--radius-md);
}

.right-sidebar .geometry-section .input:focus {
    outline: none;
    border-color: var(--border-hover);
    box-shadow: none;
}

.right-sidebar .geometry-section .fish-native-select-source {
    display: none;
}

.right-sidebar .geometry-section .fish-geometry-select-trigger {
    height: 34px;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    box-shadow: none;
    font-size: 12.5px;
}

.right-sidebar .geometry-section .fish-geometry-select-trigger:hover:not(:disabled) {
    border-color: var(--border-hover);
    background: var(--bg-secondary);
    box-shadow: none;
}

.right-sidebar .geometry-section .fish-geometry-select-trigger:is(.active, :focus-visible) {
    outline: none;
    border-color: var(--border-hover);
    background: var(--bg-secondary);
    box-shadow: none;
}

.right-sidebar .geometry-section .fish-geometry-select-trigger .searchable-select-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 0;
}

.right-sidebar .geometry-section .fish-geometry-select-trigger .searchable-select-arrow svg {
    width: 16px;
    height: 16px;
}

.fish-geometry-select-dropdown.searchable-select-floating {
    position: fixed;
    z-index: 1040;
    right: auto;
    margin: 0;
    border-radius: 8px;
    border-color: var(--border-primary);
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.fish-geometry-select-dropdown .searchable-select-search {
    min-height: 38px;
    border-radius: 8px 8px 0 0;
    border-bottom-color: var(--border-primary);
    background: var(--bg-secondary);
}

.fish-geometry-select-dropdown .searchable-select-search:focus {
    outline: none;
    border-bottom-color: var(--border-hover);
    box-shadow: none;
}

.fish-geometry-select-dropdown .searchable-select-group {
    padding: 8px 12px 4px;
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 600;
}

.fish-geometry-select-dropdown .searchable-select-option {
    padding: 6px 12px;
    font-size: 12.5px;
}

.right-sidebar .fish-properties-apply {
    min-height: 34px;
    height: auto;
    border-radius: var(--radius-md);
    padding: 4px 6px;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--brand-primary-text);
    font-size: 12px;
    font-weight: 600;
}

.right-sidebar .fish-properties-apply:hover:not(:disabled) {
    background: var(--bg-hover);
}

.right-sidebar .fish-properties-apply[hidden] {
    display: none;
}

.right-sidebar [id='addLayerBtn'] .fish-icon {
    width: 18px;
    height: 18px;
}

#breadcrumb-bar {
    background: var(--bg-secondary);
    box-shadow: none;
    border-top: 1px solid var(--border-primary);
}

#breadcrumb-bar .breadcrumb-path {
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}

#breadcrumb-bar .breadcrumb-path .bc-segment {
    min-width: 0;
}

#breadcrumb-bar .breadcrumb-path .bc-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

#breadcrumb-bar .breadcrumb-path .bc-segment:last-of-type {
    flex: 1 1 auto;
    overflow: hidden;
}

#breadcrumb-bar .breadcrumb-path .bc-segment:last-of-type .bc-value {
    flex: 0 1 auto;
}

#breadcrumb-bar .fish-bottom-rename {
    display: inline-flex;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-secondary);
}

#breadcrumb-bar .fish-bottom-rename .fish-icon {
    width: 20px;
    height: 20px;
}

#breadcrumb-bar .fish-bottom-rename:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

#breadcrumb-bar .fish-bottom-rename:disabled {
    display: none;
}

@media (width <= 800px) {
    #breadcrumb-bar .breadcrumb-path .bc-segment {
        align-items: center;
    }

    #breadcrumb-bar .breadcrumb-path .bc-segment:nth-child(1) .bc-label,
    #breadcrumb-bar .breadcrumb-path .bc-segment:nth-child(3) .bc-label,
    #breadcrumb-bar .breadcrumb-path .bc-segment:nth-child(5) .bc-label {
        display: inline-flex;
        flex: 0 0 16px;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 18px;
        font-size: 0;
        line-height: 0;
        border: 0;
    }

    #breadcrumb-bar .breadcrumb-path .bc-segment:nth-child(1) .bc-label::before,
    #breadcrumb-bar .breadcrumb-path .bc-segment:nth-child(3) .bc-label::before,
    #breadcrumb-bar .breadcrumb-path .bc-segment:nth-child(5) .bc-label::before {
        display: inline-block;
        width: 16px;
        height: 16px;
        background: currentColor;
        content: '';
        mask-repeat: no-repeat;
        mask-position: center;
        mask-size: 16px 16px;
        vertical-align: middle;
    }

    #breadcrumb-bar .breadcrumb-path .bc-segment:nth-child(1) .bc-label::before {
        mask-image: url('../icons/workspace.svg');
    }

    #breadcrumb-bar .breadcrumb-path .bc-segment:nth-child(3) .bc-label::before {
        mask-image: url('../icons/frame.svg');
    }

    #breadcrumb-bar .breadcrumb-path .bc-segment:nth-child(5) .bc-label::before {
        mask-image: url('../icons/diagram.svg');
    }

    #breadcrumb-bar .breadcrumb-path .bc-segment:nth-child(3) {
        flex: 0 1 20%;
        overflow: hidden;
    }
}

.modal-overlay {
    background: var(--bg-overlay);
}

.modal-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    animation-duration: 180ms;
}

.modal-header {
    padding: 16px 20px;
}

.modal-header h3 {
    font-size: 18px;
    line-height: 1.3;
    font-weight: 600;
}

.modal-actions {
    padding: 12px 20px;
}

.modal-actions button {
    min-height: 38px;
    box-shadow: none;
    transform: none;
}

.briefcase-open-modal .briefcase-context {
    color: var(--text-secondary);
}

.briefcase-open-modal .briefcase-toolbar [data-search]:focus {
    outline: none;
    border-color: var(--border-hover);
    box-shadow: none;
}

.briefcase-open-modal .briefcase-project,
.briefcase-open-modal .briefcase-file {
    border-radius: 0;
}

#wbs-panel .wbs-tree-placeholder {
    height: auto;
    min-height: 112px;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 10px;
    padding: 24px 16px;
    text-align: left;
}

#wbs-panel .wbs-tree-placeholder .fish-icon {
    flex: none;
    color: var(--text-tertiary);
}

#wbs-panel .wbs-frame-icon {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
}

/* The frame marker and add-folder action share one hit-area geometry. */
#wbs-panel .wbs-panel-header :is(.wbs-open-frame-btn, .wbs-header-action-btn) {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    justify-content: center;
}

#wbs-panel .wbs-header-action-btn .fish-icon {
    color: var(--text-secondary);
}

#wbs-panel .wbs-header-action-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

#wbs-panel .wbs-tree-placeholder p {
    line-height: 20px;
}

@media (width <= 600px) {
    [id='applyWidthBtn'] {
        width: 100%;
    }
}

@media (width <= 800px) {
    #breadcrumb-bar .fish-readonly-banner .fish-readonly-full {
        display: none;
    }

    #breadcrumb-bar .fish-readonly-banner .fish-readonly-compact {
        display: inline;
    }

    body > .fish-toolbar {
        top: var(--app-header-height);
        padding-inline: 8px;
    }
}

@media (width <= 480px) {
    body > header .title-container {
        flex-shrink: 0;
    }

    #breadcrumb-bar .fish-readonly-banner .fish-readonly-compact {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    #breadcrumb-bar > .fish-file-status {
        max-width: 40vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal-container {
        animation: none;
    }
}
