﻿:root {
    --blue-050: #f7fbff;
    --blue-100: #eaf5ff;
    --blue-150: #dcefff;
    --blue-200: #c9e3fb;
    --blue-300: #a7cdf0;
    --blue-600: #0876c9;
    --blue-750: #00599d;
    --yellow: #ffed78;
    --border: #a9ccec;
    --text: #202020;
    --muted: #676767;
}

* { box-sizing: border-box; }

html {
    min-height: 100%;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background: #fff;
}

body {
    min-height: 100vh;
    margin: 0;
    background: #fff;
}

a { color: #1875db; text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
    background: #fff;
    border-bottom: 1px solid #e2e2e2;
}

.header-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 70px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    color: #222;
    font-size: 24px;
    font-weight: 400;
    letter-spacing: .1px;
}

.brand:hover { text-decoration: none; }

.header-link, .pages-menu > summary, .hello, .link-button {
    font-size: 15px;
}

.header-spacer { flex: 1; }

.pages-menu {
    position: relative;
}

.pages-menu > summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.pages-menu > summary::after {
    content: " ▾";
}

.pages-menu[open] .menu-panel {
    display: grid;
}

.menu-panel {
    display: none;
    position: absolute;
    z-index: 1200;
    top: 28px;
    left: -14px;
    width: 340px;
    padding: 8px;
    background: #fff;
    border: 1px solid #c7ddef;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgb(0 0 0 / 16%);
}

.menu-panel a {
    padding: 9px 11px;
    color: #222;
    border-radius: 3px;
}

.menu-panel a:hover {
    background: var(--blue-100);
    text-decoration: none;
}

.link-button {
    border: 0;
    padding: 0;
    color: #1875db;
    background: transparent;
    cursor: pointer;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 0;
}

.page-heading {
    margin-bottom: 20px;
}

.page-heading h1 {
    margin: 0 0 5px;
    font-size: 25px;
    font-weight: 500;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
}

.grid-panel {
    margin: 0 0 24px;
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
    background: #fff;
}

.grid-panel h2 {
    margin: 0;
    padding: 8px 12px;
    color: #0064aa;
    background: linear-gradient(#eef8ff, #ddecfa);
    border-bottom: 1px solid var(--border);
    text-align: center;
    font-size: 15px;
    font-weight: 600;
}

.grid-scroll {
    width: 100%;
    overflow-x: auto;
}

.ui-jqgrid {
    border: 0 !important;
    font-family: "Segoe UI", Arial, sans-serif !important;
    font-size: 12px !important;
}

.ui-jqgrid .ui-jqgrid-view,
.ui-jqgrid .ui-jqgrid-hdiv,
.ui-jqgrid .ui-jqgrid-bdiv,
.ui-jqgrid .ui-jqgrid-pager {
    width: 100% !important;
}

.ui-jqgrid .ui-jqgrid-titlebar {
    display: none;
}

.ui-jqgrid .ui-jqgrid-htable th {
    height: 30px;
    color: #0064aa;
    background: linear-gradient(#eef8ff, #ddecfa);
    border-color: var(--border);
    font-weight: 600;
}

.ui-jqgrid tr.jqgrow td {
    height: 27px;
    padding: 3px 5px;
    border-color: var(--border);
    background: #fff;
}

.ui-jqgrid tr.jqgrow.ui-state-highlight td,
.ui-jqgrid tr.jqgrow.selected-row td {
    color: #111 !important;
    background: var(--yellow) !important;
}

.ui-jqgrid .ui-jqgrid-pager {
    min-height: 31px;
    background: linear-gradient(#edf8ff, #dceefa);
    border-color: var(--border);
}

.ui-jqgrid .ui-pg-button:hover {
    background: #cde8ff;
}

.ui-jqgrid .ui-icon {
    opacity: .9;
}

.ui-jqdialog {
    z-index: 3000 !important;
    font-size: 13px;
}

.ui-widget-overlay {
    z-index: 2999 !important;
}

.jqgrid-edit-form input,
.jqgrid-edit-form select,
.jqgrid-edit-form textarea,
.FormGrid input,
.FormGrid select,
.FormGrid textarea {
    min-height: 30px;
    border: 1px solid #9fc4e5;
    border-radius: 3px;
}

.link-toggle {
    width: 18px;
    height: 18px;
    accent-color: #0876c9;
    cursor: pointer;
}

.dashboard-red td { background: #ffb5b5 !important; }
.dashboard-yellow td { background: #fff2a8 !important; }
.dashboard-green td { background: #c7f1c7 !important; }

.upload-panel,
.user-editor-panel {
    padding-bottom: 14px;
}

.upload-panel form,
.user-editor-panel form,
.dashboard-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    padding: 14px;
}

.upload-panel label,
.user-editor-panel label,
.dashboard-filter label {
    display: grid;
    min-width: 170px;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
}

.upload-panel input,
.upload-panel select,
.user-editor-panel input,
.user-editor-panel select,
.dashboard-filter select {
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid #9fc4e5;
    border-radius: 3px;
    background: #fff;
}

button {
    min-height: 34px;
    padding: 6px 14px;
    border: 1px solid #1a6daa;
    border-radius: 4px;
    color: #fff;
    background: #0876c9;
    cursor: pointer;
}

button:hover { background: #005fa7; }

.welcome-card, .login-card {
    max-width: 760px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--blue-050);
}

.page-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.page-link-grid a {
    display: grid;
    gap: 6px;
    min-height: 105px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: #222;
    background: linear-gradient(#fff, var(--blue-050));
}

.page-link-grid a:hover {
    border-color: #5da5dd;
    text-decoration: none;
    box-shadow: 0 5px 18px rgb(0 87 152 / 10%);
}

.page-link-grid span { color: var(--muted); }

.login-card {
    max-width: 430px;
    margin: 50px auto;
}

.login-card form {
    display: grid;
    gap: 8px;
}

.login-card input {
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid #9fc4e5;
    border-radius: 4px;
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

.remember-row input { min-height: auto; }

.site-footer {
    width: min(1180px, calc(100% - 32px));
    margin: 22px auto 0;
    padding: 36px 0 55px;
    border-top: 1px solid #eee;
    color: #444;
}

.app-message {
    position: fixed;
    z-index: 5000;
    right: 22px;
    bottom: 22px;
    display: none;
    max-width: 440px;
    padding: 12px 16px;
    border-radius: 5px;
    color: #fff;
    background: #1f7b39;
    box-shadow: 0 8px 24px rgb(0 0 0 / 20%);
}

.app-message.error { background: #a72020; }

.validation-summary, .field-validation-error {
    color: #a72020;
}

@media (max-width: 760px) {
    .header-inner {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 14px;
        padding: 16px 0;
    }

    .header-spacer { display: none; }
    .hello { width: 100%; }
    .menu-panel { width: 290px; }
    .page-shell { width: calc(100% - 16px); }
}

/* Self-contained jqGrid toolbar icons. The legacy jQuery UI CSS refers to
   image files that were not present in the supplied project archive. */
.ui-icon {
    width: 16px !important;
    height: 16px !important;
    overflow: visible !important;
    background-image: none !important;
    text-indent: 0 !important;
    font-size: 0 !important;
    line-height: 16px !important;
    text-align: center !important;
}
.ui-icon::before {
    display: inline-block;
    color: #0876c9;
    font-family: "Segoe UI Symbol", "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 16px;
}
.ui-icon-plus::before { content: "+"; font-size: 20px; }
.ui-icon-pencil::before { content: "✎"; }
.ui-icon-trash::before { content: "×"; font-size: 20px; }
.ui-icon-search::before { content: "⌕"; font-size: 18px; }
.ui-icon-refresh::before { content: "↻"; font-size: 18px; }
.ui-icon-document::before { content: "▤"; }
.ui-icon-disk::before { content: "✓"; }
.ui-icon-close::before, .ui-icon-closethick::before { content: "×"; }
.ui-icon-cancel::before { content: "×"; }
.ui-icon-seek-first::before { content: "⏮"; font-size: 12px; }
.ui-icon-seek-prev::before { content: "◀"; font-size: 11px; }
.ui-icon-seek-next::before { content: "▶"; font-size: 11px; }
.ui-icon-seek-end::before { content: "⏭"; font-size: 12px; }
.ui-icon-arrowthickstop-1-w::before { content: "⏮"; font-size: 12px; }
.ui-icon-arrowthick-1-w::before { content: "◀"; font-size: 11px; }
.ui-icon-arrowthick-1-e::before { content: "▶"; font-size: 11px; }
.ui-icon-arrowthickstop-1-e::before { content: "⏭"; font-size: 12px; }
.ui-icon-circle-triangle-w::before { content: "◀"; font-size: 11px; }
.ui-icon-circle-triangle-e::before { content: "▶"; font-size: 11px; }

.row-edit-button {
    min-width: 24px;
    min-height: 22px;
    padding: 0;
    border: 0;
    color: #1682ca;
    background: transparent;
    font-size: 16px;
}
.row-edit-button:hover {
    color: #005a9f;
    background: transparent;
}

.resource-context-panel {
    margin: 0 0 24px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: linear-gradient(#f8fcff, #edf7ff);
}

.resource-context-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
}

.resource-context-controls label {
    display: grid;
    min-width: 300px;
    gap: 5px;
    color: #00599d;
    font-size: 12px;
    font-weight: 600;
}

.resource-context-controls select {
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid #9fc4e5;
    border-radius: 3px;
    background: #fff;
}

.resource-selection-summary {
    margin-top: 11px;
    padding: 9px 11px;
    border: 1px solid #b9d8f1;
    border-radius: 3px;
    color: #00599d;
    background: #fff;
    font-weight: 600;
}

.resource-center-upload {
    margin-top: 4px;
}

.resource-upload-guidance {
    margin: 0 14px 14px;
    padding: 10px 12px;
    border-left: 4px solid #0876c9;
    color: #3e3e3e;
    background: #f7fbff;
    font-size: 12px;
    line-height: 1.55;
}

#resourceWorkflows-grid tr.dashboard-red td,
#resourceDocuments-grid tr.dashboard-red td {
    background: #ff9f9f !important;
}

#resourceWorkflows-grid tr.dashboard-yellow td,
#resourceDocuments-grid tr.dashboard-yellow td {
    background: #fff29a !important;
}

#resourceWorkflows-grid tr.dashboard-green td,
#resourceDocuments-grid tr.dashboard-green td {
    background: #9ef09e !important;
}

#resourceWorkflows-grid tr.selected-row td,
#resourceDocuments-grid tr.selected-row td {
    outline: 1px solid #d6b900;
    background: var(--yellow) !important;
}

@media (max-width: 700px) {
    .resource-context-controls label {
        min-width: 100%;
    }
}


/* Dynamic jqGrid header filters shared by every grid. */
.ui-jqgrid .ui-search-toolbar th {
    height: 35px;
    padding: 2px 3px !important;
    background: #eef8ff;
    border-color: var(--border);
}

.ui-jqgrid .ui-search-toolbar .ui-search-table {
    width: 100%;
    table-layout: fixed;
}

.ui-jqgrid .ui-search-toolbar .ui-search-input {
    width: 100%;
    padding: 0 2px;
}

.ui-jqgrid .ui-search-toolbar input,
.ui-jqgrid .ui-search-toolbar select {
    width: 100% !important;
    min-width: 0;
    height: 27px;
    padding: 2px 5px;
    color: #111;
    background: #fff;
    border: 1px solid #9fc4e5;
    border-radius: 3px;
    font: inherit;
}

.ui-jqgrid .ui-search-toolbar .ui-search-clear {
    width: 17px;
    padding: 0 1px;
    text-align: center;
}

.ui-jqgrid .ui-search-toolbar .clearsearchclass {
    color: #0064aa;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.ui-jqgrid .ui-search-toolbar .clearsearchclass:hover {
    color: #d00000;
    text-decoration: none;
}

/* Shared five-row, resizable jqGrid behaviour. */
.ui-jqgrid.efiles-resizable-grid {
    position: relative;
    min-width: 340px;
}

.ui-jqgrid.efiles-resizable-grid > .ui-resizable-se {
    right: 2px;
    bottom: 2px;
    width: 16px;
    height: 16px;
    border-right: 3px solid var(--blue-600);
    border-bottom: 3px solid var(--blue-600);
    opacity: .85;
    cursor: se-resize;
}

.ui-jqgrid.efiles-resizable-grid > .ui-resizable-e {
    width: 7px;
    right: 0;
    cursor: e-resize;
}

.ui-jqgrid.efiles-resizable-grid > .ui-resizable-s {
    height: 7px;
    bottom: 0;
    cursor: s-resize;
}

/* The original pages are loaded below the combined grid in a same-origin iframe. */
body.embedded-page {
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
}

body.embedded-page .page-shell {
    width: 100%;
    margin: 0;
    padding: 8px;
}

body.embedded-page .page-heading {
    display: none;
}

body.embedded-page .grid-panel {
    margin-bottom: 12px;
}

body.embedded-page .app-message {
    position: fixed;
}

/* Global reusable AJAX/toast UI. All existing EFiles.message(...) calls now
   render here, so every page gets the same non-blocking feedback without
   page-specific markup or duplicated JavaScript. */
.efiles-toast-stack {
    position: fixed;
    z-index: 12000;
    top: 18px;
    right: 20px;
    width: min(440px, calc(100vw - 30px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.efiles-toast {
    --toast-accent: #198754;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 26px;
    align-items: start;
    gap: 10px;
    padding: 14px 14px 14px 12px;
    border-left: 6px solid var(--toast-accent);
    border-radius: 14px;
    background: rgba(255, 255, 255, .98);
    color: #14213d;
    box-shadow: 0 14px 36px rgb(0 0 0 / 22%);
    transform: translateY(-10px);
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: auto;
}

.efiles-toast.show { opacity: 1; transform: translateY(0); }
.efiles-toast.hide { opacity: 0; transform: translateY(-8px); }
.efiles-toast-loading { --toast-accent: #2f6fd6; }
.efiles-toast-error { --toast-accent: #b42318; }
.efiles-toast-info { --toast-accent: #697586; }
.efiles-toast-success { --toast-accent: #16a34a; }

.efiles-toast-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--toast-accent) 14%, white);
    color: var(--toast-accent);
    font-weight: 800;
    font-size: 18px;
}

.efiles-toast-copy { min-width: 0; }
.efiles-toast-title {
    display: block;
    margin: 0 0 2px;
    font-size: 15px;
    line-height: 1.25;
    color: #0f172a;
}
.efiles-toast-message {
    font-size: 14px;
    line-height: 1.35;
    color: #475569;
    overflow-wrap: anywhere;
}
.efiles-toast-close {
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 22px;
    line-height: 22px;
    cursor: pointer;
    padding: 0;
}
.efiles-toast-close:hover { color: #111827; }

.efiles-toast-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid rgb(47 111 214 / 24%);
    border-top-color: #2f6fd6;
    animation: efiles-toast-spin .8s linear infinite;
}
@keyframes efiles-toast-spin { to { transform: rotate(360deg); } }

/* Old single-message container is retained for backwards-compatible markup,
   but messages are now rendered by the global toast stack above. */
#app-message { display: none !important; }

@media (max-width: 620px) {
    .efiles-toast-stack {
        top: 10px;
        right: 10px;
        width: calc(100vw - 20px);
    }
}
