html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* Shared job attachment management. */
.job-attachment-dropzone {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px dashed #9eb9cc;
    border-radius: 8px;
    background: #f7fbfd;
    transition: border-color .15s ease, background-color .15s ease;
}

.job-attachment-dropzone.is-dragging {
    border-color: #0d6efd;
    background: #eaf4ff;
}

.job-attachment-dropzone > .bi {
    color: #0d6efd;
    font-size: 1.45rem;
}

.job-attachment-dropzone strong,
.job-attachment-dropzone small {
    display: block;
}

.job-attachment-dropzone small {
    margin-top: 2px;
    color: #6c7a86;
    font-size: .76rem;
}

.job-attachment-dropzone input[type="file"] {
    grid-column: 1 / -1;
}

.job-attachment-progress {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    color: #40566a;
    font-size: .84rem;
}

/* Shared job lifecycle timeline presentation. */
#jobDetailsTable {
    border-collapse: separate;
    border-spacing: 0;
}

#jobDetailsTable tbody tr > td:first-child {
    position: relative;
    padding-left: 27px;
}

#jobDetailsTable tbody tr > td:first-child::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #d8e3ec;
}

#jobDetailsTable tbody tr > td:first-child::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 17px;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #2474d8;
    box-shadow: 0 0 0 1px #8bb5e8;
}

#jobDetailsTable tbody tr:first-child > td:first-child::before {
    top: 17px;
}

#jobDetailsTable tbody tr:last-child > td:first-child::before {
    bottom: calc(100% - 22px);
}

#jobDetailsTable tbody td:nth-child(2) {
    color: #253b50;
    font-weight: 700;
}

#jobDetailsTable .job-log-date small {
    display: block;
    margin-top: 3px;
    color: #7b8b99;
    font-size: .73rem;
}

@media (prefers-reduced-motion: reduce) {
    .job-attachment-dropzone { transition: none; }
}

/* Shared long source list collapse for Process, QC and CS/Close pages. */
.job-source-collapse {
    position: relative;
}

.job-source-collapse-list {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.job-source-collapse-line {
    min-height: 1.35rem;
}

.job-source-collapse.is-collapsed .job-source-collapse-extra {
    display: none;
}

.job-source-collapse-action {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: .45rem;
    padding: .22rem .58rem;
    border: 1px solid #9ccce8;
    border-radius: 999px;
    background: #f4fbff;
    color: #075985;
    font-size: .78rem;
    font-weight: 800;
    line-height: 1.25;
}

.job-source-collapse-action:hover,
.job-source-collapse-action:focus {
    border-color: #38a3d8;
    background: #e8f7ff;
    color: #064663;
}

#qcForm #sources.job-source-readonly,
#closeForm #sources.job-source-readonly {
    min-height: 0 !important;
    padding: .45rem .6rem !important;
    line-height: 1.35 !important;
    white-space: normal !important;
}

#qcForm #sources.job-source-readonly .job-source-collapse-list,
#closeForm #sources.job-source-readonly .job-source-collapse-list {
    display: grid;
    gap: .08rem;
    white-space: normal;
}

#qcForm #sources.job-source-readonly .job-source-collapse-line,
#closeForm #sources.job-source-readonly .job-source-collapse-line {
    min-height: 0;
    line-height: 1.32;
    overflow-wrap: anywhere;
}

#qcForm #sources.job-source-readonly .job-source-collapse-action,
#closeForm #sources.job-source-readonly .job-source-collapse-action {
    margin-top: .3rem;
}

.job-source-preview-collapse {
    position: relative;
}

.job-source-preview-collapse.is-collapsed .job-source-preview-body {
    max-height: none;
    overflow: visible;
}

.job-source-preview-collapse.is-collapsed .job-source-preview-body::after {
    display: none;
}

.job-source-preview-collapse.is-collapsed .job-source-collapse-extra {
    display: none;
}

.job-source-compact-card {
    border: 1px solid #d6e0e7;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.job-source-compact-header {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .42rem .65rem;
    background: #f5f7f9;
    border-bottom: 1px solid #dce5eb;
    font-weight: 800;
}

.job-source-compact-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem;
    min-height: 36px;
    padding: .34rem .65rem;
    border-bottom: 1px solid #edf2f6;
}

.job-source-compact-row:last-child {
    border-bottom: 0;
}

.job-source-compact-name {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
}

.job-source-compact-name a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-source-compact-meta {
    color: #6d7f8d;
    font-size: .76rem;
    white-space: nowrap;
}

.navbar .dropdown:hover > .dropdown-menu {
    display: block;
}

/* Shared workflow status and job-log presentation. */
.workflow-job-status-wrap,
.qc-job-status-wrap {
    display: flex;
    align-items: flex-start;
    align-self: flex-start;
    min-width: 0;
    padding-top: 2px;
}

#btnJobStatus {
    display: none;
    width: fit-content;
    min-height: 30px;
    padding: 4px 11px !important;
    border: 1px solid #f0a3ad !important;
    border-radius: 999px !important;
    background: #fff1f3 !important;
    color: #b42335 !important;
    line-height: 1.25;
    text-decoration: none !important;
    box-shadow: 0 1px 2px rgba(180, 35, 53, .08);
}

#btnJobStatus:hover,
#btnJobStatus:focus {
    border-color: #dc6676 !important;
    background: #ffe4e8 !important;
    color: #8e1727 !important;
}

#btnJobStatus .bi {
    margin-right: 3px;
    font-size: .82rem;
}

#btnJobStatus.status-raised,
#btnJobStatus.status-assigned {
    border-color: #9fc5ff !important;
    background: #eef5ff !important;
    color: #1857c9 !important;
}

#btnJobStatus.status-finished {
    border-color: #b9b2ff !important;
    background: #f1efff !important;
    color: #5145cd !important;
}

#btnJobStatus.status-testing,
#btnJobStatus.status-processing {
    border-color: #8ed7e5 !important;
    background: #eafafd !important;
    color: #08788c !important;
}

#btnJobStatus.status-done,
#btnJobStatus.status-closed,
#btnJobStatus.status-delivered {
    border-color: #91dfbd !important;
    background: #ebfaf3 !important;
    color: #087a50 !important;
}

#btnJobStatus.status-rejected {
    border-color: #ffadb7 !important;
    background: #fff0f2 !important;
    color: #c5293d !important;
}

#jobDetailsTable .job-log-date small {
    display: block;
    margin-top: 2px;
    color: #7b8794;
    font-size: .76rem;
    line-height: 1.2;
}

#jobDetailsTable tbody tr.job-log-raised-row > td {
    height: 3.65rem;
    max-height: 3.65rem;
    overflow: hidden;
    vertical-align: top;
}

#jobDetailsTable tbody tr.job-log-raised-row .job-log-remark {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.45;
}

.navbar .dropdown-menu {
    min-width: 12rem;
    margin-top: .4rem;
    padding: .45rem;
    border: 1px solid rgba(15, 61, 86, .12);
    border-radius: 12px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 14px 32px rgba(15, 61, 86, .16);
}

.navbar .dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: .45rem;
}

.navbar .dropdown-item {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: .5rem .7rem;
    border-radius: 9px;
    color: #1f3440;
    font-weight: 600;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
    background: #e8f7fd;
    color: #036986;
    transform: translateX(2px);
}

.navbar .dropdown-item.active,
.navbar .dropdown-item:active {
    background: #0d6efd;
    color: #fff;
}

.notification-dropdown {
    width: min(390px, calc(100vw - 1rem));
    max-height: min(520px, calc(100vh - 5rem));
    overflow: hidden;
}

/* Keep the two account-area menus inside the right edge of the viewport.
   Static dropdown positioning avoids the navbar hover rule displaying them
   before Popper has calculated a safe position. */
.navbar #notificationBell + .notification-dropdown,
.navbar #userMenuDropdown + .account-dropdown {
    position: absolute !important;
    inset: auto 0 auto auto !important;
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    box-sizing: border-box;
}

/* Keep the bell and its panel touching so the dropdown does not close while
   the pointer travels from the bell into a notification message. */
.navbar #notificationBell + .notification-dropdown {
    margin-top: 0;
}

.navbar #userMenuDropdown + .account-dropdown {
    margin-top: 0;
}

.account-dropdown {
    min-width: 12rem;
    max-width: calc(100vw - 1rem);
}

/* Keep the account trigger and menu as one continuous hover target.
   This prevents the menu closing while the pointer moves down to an item. */
.navbar .user-menu-toggle {
    white-space: nowrap;
}

.navbar .user-menu-toggle::after {
    vertical-align: middle;
}

.navbar .user-menu-toggle + .account-dropdown::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 100%;
    width: 100%;
    height: 0.35rem;
}

.notification-list {
    max-height: min(440px, calc(100vh - 10rem));
    overflow-y: auto;
}

.notification-item {
    white-space: normal;
}

.notification-item:hover {
    background-color: #f3f8fc;
}

.notification-message {
    line-height: 1.35;
}

select[multiple] {
    min-height: 150px;
    max-height: 150px;
    resize: vertical;
    width: 100%;
}

select option {
    padding: 5px 8px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

    select option:hover {
        background-color: #e9ecef;
    }

    select option:checked {
        background-color: #007bff;
        color: white;
    }

.btn-move {
    min-width: 40px;
    margin: 2px 0;
}

#customerTable tbody tr:hover {
    background-color: #f5f5f5;
    cursor: pointer;
}

input:invalid, select:invalid {
    border-color: #dc3545;
}

.validation-message {
    color: #dc3545;
    font-size: 0.875em;
}

.back-to-top-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid #79bedd;
    border-radius: 50%;
    background: #e4f6fd;
    color: #0878ad;
    font-size: 1.35rem;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.back-to-top-button.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top-button:hover {
    background: #cceefa;
    color: #055d87;
}

@media (max-width: 576px) {
    .back-to-top-button {
        right: 14px;
        bottom: 14px;
        width: 42px;
        height: 42px;
    }
}

/* Structured rejection classification (QC and CS/Close). */
.rejection-classification-panel .rejection-category-help { color: #58697a; font-size: .82rem; line-height: 1.4; }
.rejection-accountability { display: inline-flex; align-items: center; border-radius: 999px; padding: .28rem .62rem; font-size: .78rem; font-weight: 700; }
.rejection-accountability.is-counted { background: #fff0f1; color: #b4232f; border: 1px solid #ffc9ce; }
.rejection-accountability.is-support { background: #eaf3ff; color: #175ca8; border: 1px solid #b9d5f4; }
.rejection-accountability.is-both { background: #e8fbff; color: #0f6f82; border: 1px solid #a7e6f2; }
.rejection-accountability.is-pending { background: #fff7df; color: #8a5b00; border: 1px solid #f3d98d; }
.rejection-guide-table-wrap, .rejection-record-list { border: 1px solid #d7e1e8; border-radius: .45rem; overflow: hidden; }
.rejection-guide-table { font-size: .8rem; }
.rejection-guide-table th { background: #edf7fb; white-space: nowrap; }
.rejection-record-item { padding: .65rem .8rem; background: #f8fafc; color: #334155; font-size: .8rem; line-height: 1.5; }
.rejection-record-item + .rejection-record-item { border-top: 1px solid #d7e1e8; }
.rejection-record-item strong { display: block; margin-bottom: .25rem; color: #172b3a; }
