/* Shared colors for the staff sign-in and dashboard. */
:root {
    --portal-ink: #102720;
    --portal-muted: #4b6158;
    --portal-paper: #f2f6f3;
    --portal-line: #d8e4db;
    --portal-dark: #102923;
    --portal-green: #166447;
    --portal-lime: #d6f768;
    --portal-font: "Segoe UI", system-ui, sans-serif;
    --portal-radius: 16px;
}
.portal-auth :focus-visible, .cbp-spmenu-push :focus-visible {
    outline: 3px solid #6a8d23;
    outline-offset: 3px;
}

/* Sign-in and password reset */
.portal-auth {
    margin: 0;
    min-height: 100vh;
    background: var(--portal-paper);
    color: var(--portal-ink);
    font: 16px/1.55 var(--portal-font);
}
.portal-auth *, .portal-auth *::before { box-sizing: border-box; }
.auth-shell { display: grid; grid-template-columns: 1.14fr 1fr; min-height: 100vh; }
.auth-image {
    margin: 20px 0 20px 20px;
    min-height: 440px;
    border-radius: 28px;
    background: linear-gradient(140deg, #0b261d80, transparent 63%),
        var(--portal-dark) url("../images/portal-tanker-branded.jpg") 79% center / cover;
}
.auth-panel {
    display: grid;
    grid-template-rows: 1fr auto;
    justify-items: center;
    align-items: center;
    gap: 32px;
    padding: clamp(24px, 5vw, 72px);
}
.auth-content, .auth-footer { width: min(100%, 420px); }
.auth-logo { display: block; width: 175px; max-width: 100%; margin-bottom: 44px; }
.auth-label { margin: 0 0 8px; color: var(--portal-green); font-size: .8rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.auth-panel h1 { margin: 0 0 28px; font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1; letter-spacing: -.055em; }
.auth-form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 6px; font-weight: 650; }
.auth-form input:not([type="hidden"]) {
    width: 100%;
    min-height: 48px;
    padding: 10px 13px;
    border: 1px solid #91ac9e;
    border-radius: 10px;
    background: #fff;
    color: var(--portal-ink);
    font: inherit;
}
.auth-link, .auth-footer a { color: var(--portal-green); font-weight: 650; text-underline-offset: .2em; }
.auth-link { justify-self: start; }
.auth-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
    padding: 9px 14px 9px 18px;
    border: 0;
    border-radius: 12px;
    background: var(--portal-lime);
    color: var(--portal-dark);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}
.auth-button:hover { background: #e1fb94; }
.auth-button span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #10292315; }
.auth-footer { display: flex; flex-wrap: wrap; gap: 5px 16px; justify-content: space-between; border-top: 1px solid var(--portal-line); padding-top: 15px; color: var(--portal-muted); font-size: .78rem; }
.auth-form .alert { border: 1px solid var(--portal-line); border-radius: 10px; padding: 12px; background: #fff; }
.auth-form .alert-warning { background: #fff6df; color: #694b18; }
.auth-form .alert-danger { background: #fff0ec; color: #843423; }
.auth-form .alert-success { background: #e6f6eb; color: #1d5938; }
.auth-form .alert a { color: inherit; }

/* Dashboard shell. The existing sidebar and dropdown scripts still own their states. */
.cbp-spmenu-push { --portal-sidebar: 232px; background: var(--portal-paper); color: var(--portal-ink); font-family: var(--portal-font); }
.cbp-spmenu-push h1, .cbp-spmenu-push h2, .cbp-spmenu-push h3,
.cbp-spmenu-push h4, .cbp-spmenu-push h5, .cbp-spmenu-push h6 { font-family: inherit; }
.cbp-spmenu-push #cbp-spmenu-s1 { top: 0; bottom: 0; width: var(--portal-sidebar); height: 100dvh; padding: 0; z-index: 1050; }
.cbp-spmenu-push .sidebar-left { position: static; width: 100%; height: 100%; overflow-y: auto; background: var(--portal-dark); }
.cbp-spmenu-push .sidebar-left .navbar { min-height: 100%; margin: 0; padding: 14px 10px; }
.portal-sidebar-brand { display: flex; align-items: center; width: fit-content; min-height: 43px; margin: 2px 10px 14px; padding: 6px 12px; border-radius: 10px; background: #fff; }
.portal-sidebar-brand img { display: block; width: 132px; height: auto; }
.cbp-spmenu-push .sidebar-menu li.header { background: transparent; color: #a5c0b4; letter-spacing: .12em; }
.cbp-spmenu-push .sidebar-menu a { color: #d4e5dd; }
.cbp-spmenu-push .sidebar-menu > li > a { border: 0; border-radius: 9px; padding: 10px 12px; }
.cbp-spmenu-push .sidebar-menu > li:hover > a, .cbp-spmenu-push .sidebar-menu > li.active > a { background: #24463c; color: var(--portal-lime); }
.cbp-spmenu-push .sidebar-menu .treeview-menu { margin: 3px 0 7px; border-radius: 9px; background: #19382f; }
.cbp-spmenu-push .sidebar-menu .treeview-menu > li > a { padding-block: 8px; }
.cbp-spmenu-push .sidebar-menu .treeview-menu > li > a.on { color: var(--portal-lime); background: #24463c; }
.cbp-spmenu-push .header-section {
    left: var(--portal-sidebar);
    width: calc(100% - var(--portal-sidebar));
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 8px clamp(12px, 2.5vw, 28px);
    border-bottom: 1px solid var(--portal-line);
    box-shadow: none;
}
.cbp-spmenu-push .header-section::after { display: none; }
.cbp-spmenu-push .header-left, .cbp-spmenu-push .header-right { float: none; width: auto; margin: 0; }
.cbp-spmenu-push .header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cbp-spmenu-push button#showLeftPush { float: none; flex: 0 0 40px; margin: 0; border-radius: 10px; color: var(--portal-dark); background: #e7f1e8; }
.cbp-spmenu-push button#showLeftPush:hover { background: var(--portal-lime); }
.portal-header-title { font-size: 14px; font-weight: 750; white-space: nowrap; }
.cbp-spmenu-push .profile_details { margin: 0; }
.cbp-spmenu-push .header-right { flex: 0 0 auto; margin-left: auto; }
.cbp-spmenu-push .profile_details > ul { margin: 0; padding: 0; }
.cbp-spmenu-push .profile_details ul li { margin-right: 0; }
.cbp-spmenu-push .profile_details_drop a.dropdown-toggle { padding: 0; }
.cbp-spmenu-push .profile_img { display: flex; align-items: center; gap: 8px; }
.cbp-spmenu-push .profile_img .prfil-img img { width: 36px; height: 36px; object-fit: cover; }
.cbp-spmenu-push .profile_img .user-name { height: auto; margin: 0; min-width: 0; max-width: clamp(75px, 19vw, 180px); }
.cbp-spmenu-push .profile_img .user-name p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbp-spmenu-push .profile_details li a i.fa.lnr { position: static; font-size: 14px; }
.cbp-spmenu-push .profile_img .clearfix { display: none; }
.cbp-spmenu-push .profile_details ul li ul.dropdown-menu.drp-mnu { right: 0; left: auto; }
.cbp-spmenu-push .profile_details .user-name p { color: var(--portal-ink); }
.cbp-spmenu-push .profile_details .user-name span { color: var(--portal-muted); }
.cbp-spmenu-push .profile_details .dropdown-menu { border-color: var(--portal-line); border-radius: 10px; }
.cbp-spmenu-push div#page-wrapper {
    margin: 0 0 0 var(--portal-sidebar);
    min-height: calc(100vh - 62px);
    padding: 86px clamp(18px, 3vw, 38px) 32px;
    background: var(--portal-paper);
}
.cbp-spmenu-push.cbp-spmenu-push-toright .header-section { left: 0; width: 100%; }
.cbp-spmenu-push .cbp-spmenu-left.cbp-spmenu-open { left: calc(-1 * var(--portal-sidebar)); }

/* Shared forms, tables and panels. Printed document styles are loaded separately. */
.cbp-spmenu-push .widget-shadow { border: 1px solid var(--portal-line); border-radius: var(--portal-radius); background: #fff; box-shadow: 0 8px 24px #1029230b; }
.cbp-spmenu-push .form-title { border-radius: var(--portal-radius) var(--portal-radius) 0 0; border-bottom: 1px solid var(--portal-line); background: #e9f2eb; }
.cbp-spmenu-push .form-title h4 { color: var(--portal-ink); font-weight: 750; }
.cbp-spmenu-push .form-control, .cbp-spmenu-push .form-control1 { border: 1px solid #a6bbad; border-radius: 8px; color: var(--portal-ink); box-shadow: none; }
.cbp-spmenu-push .form-control:focus, .cbp-spmenu-push .form-control1:focus { border-color: var(--portal-green); box-shadow: 0 0 0 2px #16644724; }
.cbp-spmenu-push .btn { border-radius: 8px; font-weight: 650; }
.cbp-spmenu-push .btn-primary { background: var(--portal-green); border-color: var(--portal-green); }
.cbp-spmenu-push .btn-primary:hover, .cbp-spmenu-push .btn-primary:focus { background: #0d5238; border-color: #0d5238; }
.cbp-spmenu-push .table > thead > tr > th { background: #e9f2eb; color: var(--portal-ink); border-bottom-color: var(--portal-line); }
.cbp-spmenu-push .table > tbody > tr > td { border-top-color: var(--portal-line); vertical-align: middle; }
.cbp-spmenu-push .table-striped > tbody > tr:nth-of-type(odd) { background: #f5f8f5; }
.cbp-spmenu-push .modal-content { border-radius: var(--portal-radius); border-color: var(--portal-line); }
.cbp-spmenu-push .footer { border-top: 1px solid var(--portal-line); box-shadow: none; }
.cbp-spmenu-push .footer p, .cbp-spmenu-push .footer p a { color: var(--portal-muted); }

@media (max-width: 767px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-image { margin: 12px 12px 0; min-height: clamp(130px, 32vw, 250px); border-radius: 18px; }
    .auth-panel { padding: 26px 24px; }
    .auth-logo { width: 145px; margin-bottom: 22px; }
    .auth-panel h1 { margin-bottom: 22px; }
    .cbp-spmenu-push #cbp-spmenu-s1 { left: calc(-1 * var(--portal-sidebar)); }
    .cbp-spmenu-push #cbp-spmenu-s1.cbp-spmenu-open { left: 0; top: 64px; height: calc(100dvh - 64px); }
    .cbp-spmenu-push .header-section { left: 0; width: 100%; }
    .cbp-spmenu-push div#page-wrapper { margin-left: 0; }
    .cbp-spmenu-push .sidebar-left .navbar-collapse { display: block; border: 0; box-shadow: none; }
    .cbp-spmenu-push .sidebar-left .navbar-toggle { display: none; }
}
@media (max-width: 380px) {
    .portal-header-title { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .cbp-spmenu-push, .cbp-spmenu-push #cbp-spmenu-s1, .cbp-spmenu-push div#page-wrapper { transition: none; }
}


/* The Home module switcher uses a native disclosure and the existing switch action. */
.module-switcher {
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
    box-shadow: 0 8px 24px #1029230b;
}
.module-switcher summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px clamp(12px, 2vw, 20px);
    border-radius: var(--portal-radius);
    cursor: pointer;
    list-style: none;
}
.module-switcher summary::-webkit-details-marker { display: none; }
.module-switcher summary:hover { background: var(--portal-paper); }
.module-switcher-heading { display: grid; gap: 2px; overflow-wrap: anywhere; }
.module-switcher-label { color: var(--portal-muted); font-size: 12px; }
.module-switcher-heading strong { font-size: 16px; }
.module-switcher-action { display: inline-flex; flex-shrink: 0; align-items: center; gap: 10px; color: var(--portal-green); font-size: 13px; font-weight: 700; }
.module-switcher-chevron { width: 8px; height: 8px; border-right: 2px solid; border-bottom: 2px solid; transform: translateY(-2px) rotate(45deg); }
.module-switcher[open] .module-switcher-chevron { transform: translateY(2px) rotate(225deg); }
.module-switcher-content { border-top: 1px solid var(--portal-line); padding: 14px; }
.module-switcher-content p { margin: 0; color: var(--portal-muted); }
.module-switcher-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.module-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 52px; height: 100%; padding: 10px 12px; border: 1px solid var(--portal-line); border-radius: 10px; background: #fff; color: var(--portal-ink); text-align: left; }
.module-option:hover:not(:disabled) { background: var(--portal-paper); border-color: var(--portal-green); }
.module-option:disabled { background: #e9f2eb; }
.module-option-copy { display: grid; gap: 2px; overflow-wrap: anywhere; }
.module-option-copy span, .module-option-current { color: var(--portal-muted); font-size: 12px; }

/* Home dashboard */
.portal-dashboard { max-width: 1440px; margin: 0 auto; }
.dashboard-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(18px, 3vw, 32px);
    margin-bottom: 18px;
    border-radius: var(--portal-radius);
    background: radial-gradient(ellipse at top right, #2e5847, transparent 70%), var(--portal-dark);
    color: #fff;
}
.portal-dashboard .dashboard-hero h1 { margin: 0; color: #fff; font-size: clamp(30px, 4vw, 48px); font-weight: 750; letter-spacing: -.045em; }
.portal-dashboard .dashboard-hero p { margin: 5px 0 0; color: #c9dfd2; }
.dashboard-filter { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.dashboard-filter label { display: grid; gap: 4px; margin: 0; color: #e1eee5; font-size: 12px; }
.dashboard-filter input, .dashboard-filter button {
    min-height: 37px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--portal-ink);
    background: #fff;
    font-size: 13px;
}
.dashboard-filter button { padding-inline: 13px; background: var(--portal-lime); font-weight: 750; }
.dashboard-filter button:hover { background: #e6fa9c; }
.dashboard-section-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 14px;
    margin-bottom: 12px;
}
.portal-dashboard .dashboard-section-heading h2 { margin: 0; color: var(--portal-ink); font-size: clamp(18px, 2vw, 22px); font-weight: 750; }
.dashboard-section-heading > span { color: var(--portal-muted); font-size: 13px; }
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr)); gap: 12px; }
.dashboard-card, .dashboard-panel { min-width: 0; padding: 16px; border: 1px solid var(--portal-line); border-radius: var(--portal-radius); background: #fff; box-shadow: 0 5px 18px #10292309; }
.dashboard-card-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.portal-dashboard .dashboard-card h3 { margin: 0; color: var(--portal-ink); font-size: 15px; font-weight: 750; }
.dashboard-card-heading i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #e7f1e8; color: var(--portal-green); }
.portal-dashboard .dashboard-total { margin: 0 0 6px; color: var(--portal-ink); font-size: 34px; font-weight: 750; line-height: 1; }
.dashboard-card dl { margin: 0; }
.dashboard-card dl > div { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid #edf2ed; padding-block: 6px; font-size: 13px; }
.dashboard-card dt { color: var(--portal-muted); font-weight: 500; }
.dashboard-card dd { margin: 0; font-weight: 750; text-align: right; }
.dashboard-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 365px), 1fr)); gap: 12px; margin-top: 16px; }
.dashboard-table-scroll { overflow-x: auto; }
.portal-dashboard .dashboard-panel .table { margin: 0; }
.portal-dashboard .dashboard-panel .table th, .portal-dashboard .dashboard-panel .table td { padding: 9px 10px; }
.portal-dashboard .dashboard-panel .table th[scope="row"] { color: var(--portal-ink); font-weight: 650; }

/* Branded loading indicator. Existing request handlers still show and hide #loader. */
.cbp-spmenu-push #loader {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    margin: 0;
    background: #10292338;
    pointer-events: none;
}
.portal-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 20px 30px 16px;
    border: 1px solid #cae7dc;
    border-radius: var(--portal-radius);
    background: #fff;
    box-shadow: 0 14px 42px #10292332;
    color: var(--portal-ink);
    font-size: 13px;
    font-weight: 700;
}
.portal-loader-orbit {
    position: relative;
    display: grid;
    place-items: center;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #e6f5ef;
}
.portal-loader-orbit img { display: block; object-fit: contain; }
.portal-loader-orbit::before {
    position: absolute;
    inset: 0;
    border: 3px solid #d1ece2;
    border-top-color: #08745f;
    border-right-color: #18a992;
    border-radius: 50%;
    content: "";
    animation: portal-loader-circle .9s linear infinite;
}
@keyframes portal-loader-circle { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .portal-loader-orbit::before { animation: none; }
}
