/*
 * Cargovy shell: the sidebar around Booking and Shipload, and the shell's own
 * pages (sign-in errors, signed out). Both modules load this file from
 * /shell/ and keep their own styling inside the content area.
 */
:root {
    --cv-sidebar-width: 232px;
    --cv-surface: #f7f7f6;
    --cv-hover: #eeeeec;
    --cv-active: #e8e8e6;
    --cv-line: #e2e2df;
    --cv-ink: #1f2328;
    --cv-ink-hover: #3a4048;
    --cv-muted: #6b7078;
    --cv-accent: #f2a541;
    --cv-font-size: 14px;
    --cv-envbar-height: 0px;
    --cv-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html.cv-has-sidebar body {
    padding-left: var(--cv-sidebar-width) !important;
}

/* Same type in every module: the sidebar's font, at one base size. */
html.cv-has-sidebar body,
html.cv-has-sidebar input,
html.cv-has-sidebar textarea,
html.cv-has-sidebar select,
html.cv-has-sidebar button,
html.cv-has-sidebar h1,
html.cv-has-sidebar h2,
html.cv-has-sidebar h3,
html.cv-has-sidebar h4,
html.cv-has-sidebar h5,
html.cv-has-sidebar h6,
html.cv-has-sidebar .ui-widget {
    font-family: var(--cv-font) !important;
}

html.cv-has-sidebar body {
    font-size: var(--cv-font-size) !important;
}

/* One heading scale in every module: Booking's Bootstrap titles were large and
   light, Shipload's section headings small and bold. Headings in dialogs keep theirs. */
html.cv-has-sidebar body > .container h1:not(.modal *, .ui-dialog *, #printerchoice *, #loadingmodal *),
html.cv-has-sidebar #maincontainer h1:not(.modal *, .ui-dialog *, #printerchoice *, #loadingmodal *) {
    font-size: 22px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: var(--cv-ink) !important;
    margin: 20px 0 16px !important;
}

html.cv-has-sidebar body > .container h2:not(.modal *, .ui-dialog *, #printerchoice *, #loadingmodal *),
html.cv-has-sidebar #maincontainer h2:not(.modal *, .ui-dialog *, #printerchoice *, #loadingmodal *) {
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: var(--cv-ink) !important;
}

html.cv-has-sidebar body > .container h3:not(.modal *, .ui-dialog *, #printerchoice *, #loadingmodal *),
html.cv-has-sidebar #maincontainer h3:not(.modal *, .ui-dialog *, #printerchoice *, #loadingmodal *) {
    font-size: 15px !important;
    font-weight: 600 !important;
}

/* The modules' fixed-width page containers fill the space next to the sidebar. */
html.cv-has-sidebar body > .container,
html.cv-has-sidebar #maincontainer {
    width: auto !important;
    margin-left: 24px !important;
    margin-right: 24px !important;
}

/* Not production: a red bar over the full width, sidebar included. */
html.cv-has-envbar {
    --cv-envbar-height: 28px;
    box-sizing: border-box;
    padding-top: var(--cv-envbar-height);
}

#cargovy-envbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    height: var(--cv-envbar-height);
    background: #d9473f;
    color: #fff;
    font: 600 12px/28px var(--cv-font);
    letter-spacing: 0.6px;
    text-align: center;
}

/* A module whose menu moved into the sidebar drops its own top bar. */
html.cv-menu-in-sidebar [data-cargovy-topbar] {
    display: none !important;
}

/* Bars a module still pins to the top stay right of the sidebar.
   Booking: .navbar-fixed-top, .warning-bar. Shipload: #menu, #developmentbar. */
html.cv-has-sidebar .navbar-fixed-top,
html.cv-has-sidebar .warning-bar,
html.cv-has-sidebar #menu,
html.cv-has-sidebar #developmentbar {
    left: var(--cv-sidebar-width) !important;
    right: 0 !important;
    width: auto !important;
}

#cargovy-sidebar {
    position: fixed;
    top: var(--cv-envbar-height);
    bottom: 0;
    left: 0;
    z-index: 1100;
    box-sizing: border-box;
    width: var(--cv-sidebar-width);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--cv-line);
    background: var(--cv-surface);
    color: var(--cv-ink);
    font: 14px/1.4 var(--cv-font);
    -webkit-font-smoothing: antialiased;
}

#cargovy-sidebar *,
#cargovy-sidebar *::before,
#cargovy-sidebar *::after {
    box-sizing: border-box;
}

#cargovy-sidebar a {
    color: inherit;
    text-decoration: none;
}

#cargovy-sidebar svg {
    flex: none;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Logo and module switch. */
#cargovy-sidebar .cv-head {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--cv-line);
}

#cargovy-sidebar .cv-logo {
    display: block;
    margin-bottom: 14px;
    padding-left: 4px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

#cargovy-sidebar .cv-logo span {
    color: var(--cv-accent);
}

#cargovy-sidebar .cv-modules {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 8px;
    background: var(--cv-active);
}

#cargovy-sidebar .cv-modules a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 4px;
    border-radius: 6px;
    color: var(--cv-muted);
    font-size: 13px;
    font-weight: 500;
}

#cargovy-sidebar .cv-modules a:hover {
    color: var(--cv-ink);
}

#cargovy-sidebar .cv-modules a.cv-active {
    background: #fff;
    color: var(--cv-ink);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

#cargovy-sidebar .cv-modules svg {
    width: 15px;
    height: 15px;
}

/* The open module's own menu. */
#cargovy-sidebar .cv-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 8px;
}

#cargovy-sidebar .cv-menu {
    margin: 0;
    padding: 0;
    list-style: none;
}

#cargovy-sidebar .cv-menu li {
    margin: 1px 0;
}

#cargovy-sidebar .cv-menu a,
#cargovy-sidebar .cv-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--cv-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

#cargovy-sidebar .cv-menu a:hover,
#cargovy-sidebar .cv-group:hover {
    background: var(--cv-hover);
}

#cargovy-sidebar .cv-group svg {
    margin-left: auto;
    width: 16px;
    height: 16px;
    color: var(--cv-muted);
    transition: transform 0.15s ease;
}

#cargovy-sidebar .cv-group[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Sub-items: indented, hung off a thin line. */
#cargovy-sidebar .cv-menu .cv-menu {
    display: none;
    margin: 2px 0 6px 18px;
    padding-left: 10px;
    border-left: 1px solid var(--cv-line);
}

#cargovy-sidebar .cv-group[aria-expanded="true"] + .cv-menu {
    display: block;
}

#cargovy-sidebar .cv-menu a.cv-current {
    background: var(--cv-active);
    font-weight: 600;
}

#cargovy-sidebar .cv-menu .cv-menu a.cv-current::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: -11px;
    width: 3px;
    border-radius: 2px;
    background: var(--cv-ink);
}

#cargovy-sidebar .cv-admin {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 8px 8px;
    padding: 7px 10px;
    border-radius: 6px;
}

#cargovy-sidebar .cv-admin:hover {
    background: var(--cv-hover);
}

#cargovy-sidebar .cv-admin.cv-current {
    background: var(--cv-active);
    font-weight: 600;
}

/* User. */
#cargovy-sidebar .cv-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 12px 16px;
    border-top: 1px solid var(--cv-line);
}

#cargovy-sidebar .cv-avatar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1d8a99;
    color: #fff;
    font-weight: 600;
}

#cargovy-sidebar .cv-who {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

#cargovy-sidebar .cv-who > * {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#cargovy-sidebar .cv-who small {
    color: var(--cv-muted);
    font-size: 12px;
}

#cargovy-sidebar a.cv-who:hover b {
    text-decoration: underline;
}

#cargovy-sidebar .cv-signout {
    display: flex;
    padding: 7px;
    border-radius: 6px;
    color: var(--cv-muted);
}

#cargovy-sidebar .cv-signout:hover {
    background: var(--cv-hover);
    color: var(--cv-ink);
}

/* The button that opens the sidebar on narrow screens. */
.cv-opener {
    display: none;
}

/* Narrow screens: the sidebar slides in over the page. */
@media (max-width: 900px) {
    :root {
        --cv-sidebar-width: 0px;
    }

    #cargovy-sidebar {
        width: 264px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    html.cv-sidebar-open #cargovy-sidebar {
        transform: none;
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.18);
    }

    html.cv-has-sidebar .cv-opener {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 16px;
        left: 16px;
        z-index: 1101;
        width: 44px;
        height: 44px;
        border: 1px solid var(--cv-line);
        border-radius: 22px;
        background: #fff;
        color: var(--cv-ink);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        cursor: pointer;
    }

    .cv-opener svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
    }

    html.cv-sidebar-open .cv-opener {
        left: 280px;
    }
}

/* The shell's own pages. */
body.cv-page {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef2f5;
    color: #1b2b36;
    font: 15px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.cv-card {
    max-width: 420px;
    margin: 16px;
    padding: 32px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(15, 42, 61, 0.12);
}

.cv-brand {
    margin-bottom: 16px;
    color: var(--cv-ink);
    font-size: 22px;
    font-weight: 700;
}

.cv-card h1 {
    margin: 0 0 8px;
    font-size: 20px;
}

.cv-button {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 6px;
    background: var(--cv-ink);
    color: #fff;
    text-decoration: none;
}

.cv-button:hover {
    background: var(--cv-ink-hover);
}
