/*
 * IFM command navigation
 *
 * This layer is intentionally scoped to .ifm-nav--command. IFM Rehber keeps
 * its established navigation untouched while the operational workspaces gain
 * a frequency-led hierarchy.
 */

.ifm-nav.ifm-nav--command {
    --command-navy: #142943;
    --command-blue: #315d87;
    --command-ink: #202b36;
    --command-muted: #6d7479;
    --command-paper: #f5f2eb;
    --command-surface: #fffdf8;
    --command-line: rgba(20, 41, 67, .11);
    --command-warm: #a24b3e;
    --command-nav-font: "DM Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --command-nav-font-size: 11px;
    --command-nav-meta-size: 8px;
    font-family: var(--command-nav-font);
    border-bottom-color: rgba(20, 41, 67, .16);
    background: rgba(247, 244, 237, .96);
    box-shadow: 0 10px 34px rgba(20, 41, 67, .09);
}

.ifm-nav--command .ifm-nav__inner,
.ifm-nav--command .ifm-nav__operations,
.ifm-nav--command .ifm-nav__context {
    width: min(calc(100% - 36px), 1320px);
}

.ifm-nav--command .ifm-nav__inner {
    min-height: 62px;
    gap: 20px;
}

.ifm-nav--command .ifm-nav__brand {
    gap: 10px;
    padding-right: 18px;
    border-right: 1px solid var(--command-line);
}

.ifm-nav--command .ifm-nav__logo-frame {
    width: 65px;
    height: 42px;
    border-radius: 9px;
    box-shadow: inset 0 0 0 1px rgba(20, 41, 67, .07);
}

.ifm-nav--command .ifm-nav__logo-frame img {
    width: 65px;
    height: 65px;
    transform: translateY(-12px);
}

.ifm-nav--command .ifm-nav__brand-copy strong {
    color: var(--command-navy);
    font-size: 15px;
}

.ifm-nav--command .ifm-nav__brand-copy small { color: #7a746b; }

.ifm-nav--command .ifm-nav__workspace-switcher {
    position: relative;
    gap: 2px;
    border-color: var(--command-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .66);
    padding: 3px;
}

.ifm-nav--command .ifm-nav__workspace-switcher::before {
    content: "01";
    position: absolute;
    top: -7px;
    left: 10px;
    border-radius: 999px;
    background: var(--command-paper);
    padding: 0 4px;
    color: #8c8176;
    font-size: 6px;
    font-weight: 950;
    letter-spacing: .1em;
}

.ifm-nav--command .ifm-nav__modules a {
    min-height: 34px;
    border-radius: 9px;
    padding-inline: 15px;
    color: #697077;
    font-family: var(--command-nav-font);
    font-size: var(--command-nav-font-size) !important;
    line-height: 1;
    letter-spacing: .02em;
}

.ifm-nav--command .ifm-nav__modules a.is-active {
    background: var(--command-navy);
    box-shadow: 0 5px 14px rgba(20, 41, 67, .18);
}

.ifm-nav--command .ifm-nav__account { gap: 3px; }
.ifm-nav--command .ifm-nav__mobile-account { display: block; }
.ifm-nav--command .ifm-nav__mobile-account-trigger {
    width: 34px;
    height: 34px;
    border: 1px solid var(--command-line);
    background: rgba(255, 255, 255, .64);
    color: var(--command-navy);
    font-family: var(--command-nav-font);
    font-size: var(--command-nav-font-size);
    letter-spacing: 0;
}

.ifm-nav--command .ifm-nav__agent-mode {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(46, 104, 75, .13);
    border-radius: 999px;
    background: rgba(224, 239, 228, .58);
    padding: 6px 9px;
    color: #386a4e;
    font-family: var(--command-nav-font);
    font-size: var(--command-nav-meta-size);
    font-weight: 900;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ifm-nav--command .ifm-nav__agent-mode i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4f9368;
    box-shadow: 0 0 0 3px rgba(79, 147, 104, .12);
}

.ifm-nav--command .ifm-nav__operations {
    min-height: 48px;
    justify-content: flex-start;
    gap: 0;
    border-top-color: var(--command-line);
}

.ifm-nav--command .ifm-nav__operations .ifm-nav__links {
    flex: 1;
    gap: 2px;
    padding-block: 5px;
}

.ifm-nav--command .ifm-nav__links a,
.ifm-nav--command .ifm-nav__links button {
    min-height: 35px;
    border-radius: 9px;
    padding: 8px 12px;
    color: #5e666d;
    font-family: var(--command-nav-font);
    font-size: var(--command-nav-font-size) !important;
    font-weight: 850;
    line-height: 1;
}

.ifm-nav--command .ifm-nav__links a:hover,
.ifm-nav--command .ifm-nav__links button:hover {
    background: rgba(255, 255, 255, .83);
    color: var(--command-navy);
}

.ifm-nav--command .ifm-nav__links a.is-active {
    background: var(--command-navy);
    box-shadow: 0 5px 13px rgba(20, 41, 67, .15);
    color: #fff;
}

.ifm-nav--command .ifm-nav__links .ifm-nav__link--priority:not(.is-active) {
    background: rgba(49, 93, 135, .075);
    color: #274e73;
}

.ifm-nav--command .ifm-nav__links .ifm-nav__link--priority:not(.is-active)::after {
    content: "";
    width: 4px;
    height: 4px;
    margin-left: 6px;
    border-radius: 50%;
    background: #4d7da9;
}

.ifm-nav--command .ifm-nav__links .ifm-nav__link--secondary {
    position: relative;
    margin-left: 9px;
    color: #7d7b76;
}

.ifm-nav--command .ifm-nav__links .ifm-nav__link--secondary::before {
    content: "";
    position: absolute;
    top: 7px;
    bottom: 7px;
    left: -6px;
    width: 1px;
    background: var(--command-line);
}

.ifm-nav--command .ifm-nav__level {
    width: 82px;
    min-width: 82px;
    align-self: stretch;
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    margin-right: 9px;
    border-right: 1px solid var(--command-line);
    color: #827c73;
}

.ifm-nav--command .ifm-nav__level b {
    width: 25px;
    height: 25px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: rgba(20, 41, 67, .07);
    color: var(--command-navy);
    font-family: var(--command-nav-font);
    font-size: var(--command-nav-meta-size);
    font-weight: 950;
}

.ifm-nav--command .ifm-nav__level small {
    overflow: hidden;
    color: #7b756d;
    font-family: var(--command-nav-font);
    font-size: var(--command-nav-meta-size);
    font-weight: 900;
    letter-spacing: .08em;
    line-height: 1.15;
    text-transform: uppercase;
    text-overflow: ellipsis;
}

.ifm-nav--command .ifm-nav__context {
    min-height: 42px;
    gap: 0;
    border-top-color: var(--command-line);
}

.ifm-nav--command .ifm-nav__context--detail {
    min-height: 43px;
    background: rgba(255, 255, 255, .41);
}

.ifm-nav--command .ifm-nav__context .ifm-nav__subnav {
    flex: 1;
    width: auto;
    padding: 4px 0;
    gap: 3px;
}

.ifm-nav--command .ifm-nav__context--detail .ifm-nav__subnav::before { content: none; }

.ifm-nav--command .ifm-nav__context .ifm-nav__subnav a {
    min-height: 32px;
    border-radius: 8px;
    padding: 7px 12px;
    color: #697078;
    font-family: var(--command-nav-font);
    font-size: var(--command-nav-font-size) !important;
    font-weight: 850;
    line-height: 1;
}

.ifm-nav--command .ifm-nav__context .ifm-nav__subnav a:hover {
    background: rgba(255, 255, 255, .9);
    color: var(--command-navy);
}

.ifm-nav--command .ifm-nav__context .ifm-nav__subnav a.is-active {
    background: var(--command-navy);
    box-shadow: 0 4px 11px rgba(20, 41, 67, .14);
    color: #fff;
}

.ifm-nav--command .ifm-nav__context .ifm-nav__subnav a.ifm-nav__subnav-priority:not(.is-active) {
    border: 1px solid rgba(49, 93, 135, .13);
    background: rgba(49, 93, 135, .07);
    color: #244f76;
}

.ifm-nav--command .ifm-nav__context .ifm-nav__subnav a.ifm-nav__subnav-secondary {
    color: #85817b;
}

.ifm-nav--command .ifm-nav__context .ifm-nav__subnav a.ifm-nav__subnav-secondary:first-of-type,
.ifm-nav--command .ifm-nav__context .ifm-nav__subnav a.ifm-nav__subnav-priority + a:not(.ifm-nav__subnav-priority) {
    margin-left: 7px;
}

.ifm-nav--command .ifm-nav__context--job .ifm-nav__level b {
    background: rgba(162, 75, 62, .1);
    color: var(--command-warm);
}

/* Manual CRUD is demoted to a database/agent concern. Existing records stay
   visible as calm, read-only facts; creation affordances leave the page. */
body.ifm-agent-entry-mode main form.ifm-agent-readonly :is(input, select, textarea) {
    border-color: transparent !important;
    border-bottom-color: rgba(20, 41, 67, .1) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: inherit !important;
    cursor: default !important;
    font-weight: 650 !important;
    opacity: 1 !important;
    padding-inline: 0 !important;
    pointer-events: none !important;
    -webkit-text-fill-color: currentColor !important;
}

body.ifm-agent-entry-mode main form.ifm-agent-readonly select {
    appearance: none;
    -webkit-appearance: none;
}

body.ifm-agent-entry-mode main form.ifm-agent-readonly :is(button, input[type="submit"], input[type="file"]) {
    display: none !important;
}

body.ifm-agent-entry-mode main :is(
    [data-record-edit],
    [data-create-lane],
    [data-delete-entry],
    [data-day-report-delete],
    [data-timeline-detail-edit],
    .k-edit-button,
    .k-record-actions,
    .site-board-record-actions
) {
    display: none !important;
}

body.ifm-agent-entry-mode main .ifm-agent-entry-hidden { display: none !important; }

body.ifm-agent-entry-mode main [contenteditable="true"] {
    pointer-events: none !important;
}

body[data-contractor-tab="isler"] #contractor-work { display: block; }

@media (max-width: 900px) {
    .ifm-nav--command .ifm-nav__inner,
    .ifm-nav--command .ifm-nav__operations,
    .ifm-nav--command .ifm-nav__context { width: 100%; }
    .ifm-nav--command .ifm-nav__inner { padding-inline: 10px; }
    .ifm-nav--command .ifm-nav__brand-copy { display: none; }
    .ifm-nav--command .ifm-nav__brand { padding-right: 10px; }
    .ifm-nav--command .ifm-nav__agent-mode { display: none; }
    .ifm-nav--command .ifm-nav__operations,
    .ifm-nav--command .ifm-nav__context { padding-inline: 10px; }
}

@media (max-width: 760px) {
    .ifm-nav.ifm-nav--command .ifm-nav__inner { min-height: 56px; padding: 6px 7px; }
    .ifm-nav--command .ifm-nav__brand { flex-basis: 43px; border-right: 0; padding-right: 0; }
    .ifm-nav--command .ifm-nav__logo-frame { width: 42px; height: 36px; }
    .ifm-nav--command .ifm-nav__logo-frame img { width: 58px; height: 58px; transform: translate(-8px, -11px); }
    .ifm-nav--command .ifm-nav__workspace-switcher { border-radius: 10px; }
    .ifm-nav--command .ifm-nav__workspace-switcher::before { display: none; }
    .ifm-nav--command .ifm-nav__workspace-switcher a { border-radius: 8px; }
    .ifm-nav--command .ifm-nav__level {
        width: 31px;
        min-width: 31px;
        grid-template-columns: 24px;
        margin-right: 5px;
    }
    .ifm-nav--command .ifm-nav__level b { width: 24px; height: 24px; }
    .ifm-nav--command .ifm-nav__level small { display: none; }
    .ifm-nav--command .ifm-nav__operations { min-height: 43px; padding-block: 0; }
    .ifm-nav--command .ifm-nav__context { min-height: 40px; padding-block: 0; }
    .ifm-nav--command .ifm-nav__links a,
    .ifm-nav--command .ifm-nav__links button,
    .ifm-nav--command .ifm-nav__context .ifm-nav__subnav a {
        padding-inline: 9px;
        font-size: var(--command-nav-font-size) !important;
    }
    .ifm-nav--command .ifm-nav__mobile-account { display: block; }
}

@media (max-width: 460px) {
    .ifm-nav--command .ifm-nav__notification-trigger { width: 30px; }
    .ifm-nav--command .ifm-nav__mobile-account-trigger { width: 30px; height: 30px; }
    .ifm-nav--command .ifm-nav__admin { display: none; }
    .ifm-nav--command .ifm-nav__links .ifm-nav__link--secondary { margin-left: 5px; }
}
