/*
 * EIISYS professional module shell — structure-preserving edition.
 *
 * The original module/template/navigation.php remains authoritative. This CSS
 * only presents that markup in a consistent two-row enterprise shell.
 */

:root {
    --eis-shell-bg: #f6f8fb;
    --eis-shell-surface: #ffffff;
    --eis-shell-surface-soft: #f8fafc;
    --eis-shell-text: #172033;
    --eis-shell-text-2: #344054;
    --eis-shell-muted: #667085;
    --eis-shell-border: #e1e6ed;
    --eis-shell-border-strong: #cbd4df;
    --eis-shell-shadow: 0 7px 22px rgba(15, 23, 42, .055);
}

.eis-shell-skip {
    position: fixed;
    top: -60px;
    left: 16px;
    z-index: 5000;
    padding: 9px 13px;
    border-radius: 0 0 7px 7px;
    background: #111827;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}
.eis-shell-skip:focus { top: 0; }

.eis-top-shell-v2 {
    position: sticky;
    top: 0;
    z-index: 1200;
    width: 100%;
    border-top: 4px solid var(--eis-module);
    background: rgba(255, 255, 255, .98);
    box-shadow: var(--eis-shell-shadow);
    color: var(--eis-shell-text);
}

.eis-shell-appbar {
    min-height: 68px;
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(300px, 570px) minmax(250px, 1fr);
    align-items: center;
    gap: 22px;
    padding: 8px 26px;
    border-bottom: 1px solid var(--eis-shell-border);
    background: #fff;
}

.eis-shell-appbar-left,
.eis-shell-actions,
.eis-shell-brand,
.eis-shell-module-identity,
.eis-shell-user-summary,
.eis-shell-user-card {
    display: flex;
    align-items: center;
}

.eis-shell-appbar-left { min-width: 0; }
.eis-shell-actions { justify-content: flex-end; gap: 7px; min-width: 0; }

.eis-shell-brand {
    min-width: 0;
    gap: 10px;
    cursor: default;
    user-select: none;
}
.eis-shell-brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 10px;
    background: #111827;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
}
.eis-shell-brand-copy,
.eis-shell-module-identity > span:last-child,
.eis-shell-user-copy { min-width: 0; }
.eis-shell-brand-copy strong,
.eis-shell-brand-copy small,
.eis-shell-module-identity strong,
.eis-shell-module-identity small,
.eis-shell-user-copy strong,
.eis-shell-user-copy small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.eis-shell-brand-copy strong { max-width: 190px; font-size: 13px; line-height: 1.3; }
.eis-shell-brand-copy small { margin-top: 2px; color: var(--eis-shell-muted); font-size: 10px; }
.eis-shell-separator { width: 1px; height: 36px; margin: 0 14px; background: var(--eis-shell-border); }

.eis-shell-module-identity {
    gap: 9px;
    min-width: 0;
    color: var(--eis-shell-text);
    text-decoration: none;
}
.eis-shell-module-identity:hover { color: var(--eis-module-dark); }
.eis-shell-module-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 10px;
    background: var(--eis-module-soft);
    color: var(--eis-module);
    font-size: 17px;
}
.eis-shell-module-identity strong { font-size: 13px; }
.eis-shell-module-identity small { max-width: 175px; margin-top: 2px; color: var(--eis-shell-muted); font-size: 11px; }

.eis-shell-search-open {
    width: 100%;
    height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 11px 0 14px;
    border: 1px solid var(--eis-shell-border-strong);
    border-radius: 10px;
    background: var(--eis-shell-surface-soft);
    color: var(--eis-shell-muted);
    cursor: pointer;
    text-align: left;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.eis-shell-search-open:hover,
.eis-shell-search-open:focus {
    outline: 0;
    border-color: rgba(var(--eis-module-rgb), .52);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(var(--eis-module-rgb), .09);
}
.eis-shell-search-open span { flex: 1; }
.eis-shell-search-open kbd,
.eis-module-search kbd {
    padding: 2px 6px;
    border: 1px solid var(--eis-shell-border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: #fff;
    color: var(--eis-shell-muted);
    font: 600 10px/1.4 "Segoe UI", Arial, sans-serif;
}

.eis-shell-icon-button,
.eis-shell-mobile-menu,
.eis-shell-user-summary {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--eis-shell-text-2);
    cursor: pointer;
    text-decoration: none;
}
.eis-shell-icon-button,
.eis-shell-mobile-menu {
    display: inline-grid;
    place-items: center;
    min-width: 40px;
    padding: 0 10px;
}
.eis-shell-mobile-menu { display: none; }
.eis-shell-icon-button:hover,
.eis-shell-mobile-menu:hover,
.eis-shell-user-summary:hover,
.eis-shell-user-menu[open] > .eis-shell-user-summary {
    border-color: rgba(var(--eis-module-rgb), .14);
    background: var(--eis-module-soft);
    color: var(--eis-module-dark);
}

.eis-shell-user-menu { position: relative; }
.eis-shell-user-menu > summary { list-style: none; }
.eis-shell-user-menu > summary::-webkit-details-marker { display: none; }
.eis-shell-user-summary { gap: 8px; padding: 3px 7px 3px 4px; user-select: none; }
.eis-shell-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    background: var(--eis-module);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .03em;
}
.eis-shell-avatar-large { width: 44px; height: 44px; flex-basis: 44px; font-size: 13px; }
.eis-shell-user-copy { max-width: 145px; text-align: left; }
.eis-shell-user-copy strong { font-size: 11px; }
.eis-shell-user-copy small { margin-top: 1px; color: var(--eis-shell-muted); font-size: 10px; }
.eis-shell-user-caret { font-size: 11px; }
.eis-shell-user-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1500;
    width: 265px;
    padding: 8px;
    border: 1px solid var(--eis-shell-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .15);
}
.eis-shell-user-card { gap: 10px; padding: 8px 8px 12px; margin-bottom: 5px; border-bottom: 1px solid var(--eis-shell-border); }
.eis-shell-user-card strong,
.eis-shell-user-card span { display: block; }
.eis-shell-user-card strong { font-size: 12px; }
.eis-shell-user-card span { margin-top: 2px; color: var(--eis-shell-muted); font-size: 10px; }
.eis-shell-user-panel > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 7px;
    color: var(--eis-shell-text-2);
    text-decoration: none;
    font-size: 12px;
}
.eis-shell-user-panel > a:hover { background: var(--eis-module-soft); color: var(--eis-module-dark); }
.eis-shell-user-panel > a > i { width: 15px; text-align: center; }
.eis-shell-user-divider { height: 1px; margin: 5px 3px; background: var(--eis-shell-border); }
.eis-shell-user-panel .eis-shell-logout:hover { background: #fef3f2; color: #b42318; }

/* The original module navigation is retained verbatim and only restyled here. */
.eis-module-nav-source { min-height: 47px; background: #fff; }
.eis-module-nav-source .w3-top {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
    width: 100% !important;
    box-shadow: none !important;
}
.eis-module-nav-source .w3-bar,
.eis-module-nav-source .w3-bar.w3-teal,
.eis-module-nav-source .w3-top > .w3-bar {
    min-height: 47px;
    display: flex;
    align-items: stretch;
    width: 100%;
    padding: 0 25px;
    overflow: visible;
    border: 0 !important;
    background: #fff !important;
    color: var(--eis-shell-text-2) !important;
    box-shadow: none !important;
    scrollbar-width: thin;
}
.eis-module-nav-source .w3-bar::after,
.eis-module-nav-source .w3-bar::before { display: none !important; }

.eis-module-nav-source .w3-bar > .w3-dropdown-hover,
.eis-module-nav-source .w3-bar > .eis-promoted-nav-link,
.eis-module-nav-source .w3-bar > .eis-return-nav-link {
    float: none !important;
    flex: 0 0 auto;
    position: relative;
    border: 0 !important;
    background: transparent !important;
}

.eis-module-nav-source .w3-bar > .w3-dropdown-hover > .w3-button,
.eis-module-nav-source .w3-bar > .w3-dropdown-hover > a.w3-button,
.eis-module-nav-source .eis-promoted-nav-link,
.eis-module-nav-source .eis-return-nav-link {
    min-height: 47px;
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    padding: 0 13px !important;
    border: 0 !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    background: #fff !important;
    color: var(--eis-shell-text-2) !important;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: color .14s ease, background .14s ease, border-color .14s ease;
}
.eis-module-nav-source .w3-bar > .w3-dropdown-hover:hover > .w3-button,
.eis-module-nav-source .w3-bar > .w3-dropdown-hover:hover > a.w3-button,
.eis-module-nav-source .w3-bar > .w3-dropdown-hover.eis-nav-active > .w3-button,
.eis-module-nav-source .w3-bar > .w3-dropdown-hover.eis-nav-active > a.w3-button,
.eis-module-nav-source .eis-promoted-nav-link:hover,
.eis-module-nav-source .eis-promoted-nav-link.eis-nav-active,
.eis-module-nav-source .eis-return-nav-link:hover,
.eis-module-nav-source .eis-return-nav-link.eis-nav-active {
    background: var(--eis-module-soft) !important;
    color: var(--eis-module-dark) !important;
    border-bottom-color: var(--eis-module) !important;
}
.eis-module-nav-source .eis-menu-icon { color: var(--eis-module); font-size: 12px; }
.eis-module-nav-source .fa-caret-down { margin-left: 2px; color: #98a2b3; font-size: 10px; }
.eis-module-nav-source .eis-nav-divider { width: 1px; height: 24px; flex: 0 0 1px; align-self: center; margin: 0 4px; background: var(--eis-shell-border); }
.eis-module-nav-source .eis-nav-spacer { flex: 1 1 auto; min-width: 12px; }
.eis-module-nav-source .eis-return-nav-link { color: var(--eis-module-dark) !important; font-weight: 600; }

/* Hide only the legacy duplicate user area; its actions live in the top app bar. */
.eis-module-nav-source .w3-bar > span[style*="float"] { display: none !important; }

.eis-module-nav-source .w3-dropdown-content {
    min-width: 235px;
    max-height: min(72vh, 620px);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--eis-shell-border) !important;
    border-top: 3px solid var(--eis-module) !important;
    border-radius: 0 0 9px 9px !important;
    background: #fff !important;
    box-shadow: 0 14px 30px rgba(15, 23, 42, .13) !important;
}
.eis-module-nav-source .w3-dropdown-content .w3-bar-item,
.eis-module-nav-source .w3-dropdown-content a.w3-bar-item {
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 8px 10px !important;
    border: 0 !important;
    border-radius: 6px;
    background: #fff !important;
    color: var(--eis-shell-text-2) !important;
    font-size: 12px;
    line-height: 1.35;
    text-decoration: none;
}
.eis-module-nav-source .w3-dropdown-content .w3-bar-item:hover,
.eis-module-nav-source .w3-dropdown-content .w3-bar-item.eis-nav-active {
    background: var(--eis-module-soft) !important;
    color: var(--eis-module-dark) !important;
}
.eis-module-nav-source .w3-dropdown-content hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--eis-shell-border); }

/* Legacy EIISYS templates reserved space for the former absolutely-positioned
   footer (body margin-bottom:60px and content margin-bottom:80px). The shared
   contextual footer is now in normal document flow, so those reservations must
   not survive. A flex page shell keeps the footer flush with the viewport bottom
   on short screens while allowing it to follow long content naturally. */
html { min-height: 100%; }
body {
    min-height: 100vh;
    margin-bottom: 0 !important;
    display: flex;
    flex-direction: column;
}
#wrap {
    width: 100%;
    flex: 1 0 auto;
}

/* Existing headers also reserve 60-80px for the former fixed W3 navigation and
   footer. Keep only a modest working-space margin around the page content. */
#wrap > .eis-top-shell-v2 ~ .w3-content,
#wrap > .eis-top-shell-v2 ~ .w3-container {
    margin-top: 18px !important;
    margin-bottom: 18px !important;
}

/* Module-local command/search palette. */
.eis-module-search[hidden] { display: none !important; }
.eis-module-search {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 9vh 18px 30px;
    background: rgba(15, 23, 42, .46);
    backdrop-filter: blur(4px);
}
.eis-module-search-dialog {
    width: min(720px, 100%);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 26px 70px rgba(15, 23, 42, .28);
}
.eis-module-search-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 0 16px;
    border-bottom: 1px solid var(--eis-shell-border);
}
.eis-module-search-input-row > i { color: var(--eis-module); font-size: 17px; }
.eis-module-search-input-row input {
    flex: 1;
    min-width: 0;
    height: 58px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--eis-shell-text);
    font: 500 15px/1.4 "Segoe UI", Arial, sans-serif;
}
.eis-module-search-input-row button { padding: 4px; border: 0; background: transparent; cursor: pointer; }
.eis-module-search-scope {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 17px;
    border-bottom: 1px solid var(--eis-shell-border);
    background: var(--eis-module-soft);
    color: var(--eis-module-dark);
    font-size: 11px;
}
.eis-module-search-results { max-height: min(52vh, 430px); overflow-y: auto; padding: 7px; }
.eis-module-search-result {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--eis-shell-text);
    text-decoration: none;
}
.eis-module-search-result:hover,
.eis-module-search-result.is-selected { background: var(--eis-module-soft); color: var(--eis-module-dark); }
.eis-module-search-result-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f2f4f7;
    color: var(--eis-shell-muted);
}
.eis-module-search-result.is-selected .eis-module-search-result-icon { background: #fff; color: var(--eis-module); }
.eis-module-search-result-copy strong,
.eis-module-search-result-copy small { display: block; }
.eis-module-search-result-copy strong { font-size: 12px; }
.eis-module-search-result-copy small { margin-top: 2px; color: var(--eis-shell-muted); font-size: 10px; }
.eis-module-search-empty { padding: 44px 20px; text-align: center; color: var(--eis-shell-muted); }
.eis-module-search-empty > i { display: block; margin-bottom: 8px; color: #98a2b3; font-size: 28px; }
.eis-module-search-empty strong,
.eis-module-search-empty span { display: block; }
.eis-module-search-empty strong { color: var(--eis-shell-text-2); font-size: 13px; }
.eis-module-search-empty span { margin-top: 4px; font-size: 11px; }
.eis-module-search-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px 14px;
    border-top: 1px solid var(--eis-shell-border);
    background: var(--eis-shell-surface-soft);
    color: var(--eis-shell-muted);
    font-size: 10px;
}
.eis-module-search-footer span:last-child { margin-left: auto; }
body.eis-module-search-open { overflow: hidden; }

@media (max-width: 1180px) {
    .eis-module-nav-source .w3-bar { flex-wrap: wrap; }
}

@media (max-width: 1040px) {
    .eis-shell-appbar { grid-template-columns: minmax(260px, 1fr) minmax(250px, 410px) auto; gap: 14px; padding-inline: 16px; }
    .eis-shell-user-copy, .eis-shell-user-caret { display: none; }
    .eis-module-nav-source .w3-bar { padding-inline: 14px; }
}

@media (max-width: 760px) {
    .eis-shell-appbar { grid-template-columns: minmax(0, 1fr) auto; min-height: 62px; }
    .eis-shell-brand-copy small, .eis-shell-separator, .eis-shell-module-identity { display: none; }
    .eis-shell-search-open { grid-column: 1 / -1; grid-row: 2; margin-bottom: 3px; }
    .eis-shell-mobile-menu { display: inline-grid; }
    .eis-module-nav-source { display: none; border-top: 1px solid var(--eis-shell-border); }
    .eis-top-shell-v2.eis-mobile-nav-open .eis-module-nav-source { display: block; }
    .eis-module-nav-source .w3-bar {
        display: block;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        padding: 8px;
    }
    .eis-module-nav-source .w3-bar > .w3-dropdown-hover,
    .eis-module-nav-source .w3-bar > .eis-promoted-nav-link,
    .eis-module-nav-source .w3-bar > .eis-return-nav-link {
        display: block !important;
        width: 100%;
    }
    .eis-module-nav-source .w3-hide-small { display: block !important; }
    .eis-module-nav-source .w3-bar > .w3-dropdown-hover > .w3-button,
    .eis-module-nav-source .w3-bar > .w3-dropdown-hover > a.w3-button,
    .eis-module-nav-source .eis-promoted-nav-link,
    .eis-module-nav-source .eis-return-nav-link {
        width: 100%;
        justify-content: flex-start;
        border-radius: 7px !important;
        border-bottom: 0 !important;
    }
    .eis-module-nav-source .w3-dropdown-content {
        position: static !important;
        min-width: 0;
        width: 100%;
        max-height: none;
        margin: 0 0 5px;
        border-top-width: 1px !important;
        border-radius: 7px !important;
        box-shadow: none !important;
        background: #f8fafc !important;
    }
    .eis-module-nav-source .eis-nav-divider,
    .eis-module-nav-source .eis-nav-spacer { display: none; }
    .eis-module-search { padding-top: 3vh; }
    .eis-module-search-footer span:last-child { display: none; }
}

@media (max-width: 480px) {
    .eis-shell-appbar { padding-inline: 10px; }
    .eis-shell-brand-copy strong { max-width: 180px; }
    .eis-shell-icon-button { display: none; }
    .eis-module-search-footer { gap: 8px; }
}

@media print {
    .eis-top-shell-v2,
    .eis-module-search,
    .eis-shell-skip { display: none !important; }
    #wrap > .eis-top-shell-v2 ~ .w3-content,
    #wrap > .eis-top-shell-v2 ~ .w3-container { margin-top: 0 !important; }
}

/* -------------------------------------------------------------------------
 * Contextual footer
 * -------------------------------------------------------------------------
 * One quiet, consistent footer across modules. It identifies the client,
 * product and current module without introducing any new navigation path.
 */
.eis-context-footer {
    width: 100%;
    flex: 0 0 auto;
    margin-top: 0;
    border-top: 1px solid var(--eis-shell-border);
    background: #fff;
    color: var(--eis-shell-muted);
    font-size: 11px;
    line-height: 1.4;
}

.eis-context-footer__inner {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 28px;
}

.eis-context-footer__system,
.eis-context-footer__meta,
.eis-context-footer__module {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.eis-context-footer__system strong {
    color: var(--eis-shell-text-2);
    font-size: 11px;
    letter-spacing: .01em;
}

.eis-context-footer__meta {
    justify-content: flex-end;
    white-space: nowrap;
}

.eis-context-footer__dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--eis-module);
    box-shadow: 0 0 0 3px rgba(var(--eis-module-rgb), .08);
}

.eis-context-footer__separator { color: #98a2b3; }

.eis-context-footer a {
    color: var(--eis-module-dark);
    font-weight: 600;
    text-decoration: none;
}

.eis-context-footer a:hover,
.eis-context-footer a:focus {
    color: var(--eis-module);
    text-decoration: underline;
    outline: 0;
}

@media (max-width: 760px) {
    .eis-context-footer__inner {
        min-height: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding: 12px 16px;
    }

    .eis-context-footer__meta {
        justify-content: flex-start;
        white-space: normal;
        flex-wrap: wrap;
    }
}

@media print {
    .eis-context-footer { display: none !important; }
}
