/* Global light theme overrides */
:root {
    --bg-deep: #ffffff !important;
    --card-dark: #ffffff !important;
    --bg: #ffffff !important;
    --card: #ffffff !important;
    --text-light: #0f172a !important;
    --text-dim: #64748b !important;
    --text: #0f172a !important;
    --border-glow: rgba(15, 23, 42, 0.18) !important;
    --border: rgba(15, 23, 42, 0.22) !important;
    --rose: #f43f5e !important;
}

html,
body {
    background-color: #ffffff !important;
    color: #0f172a !important;
    font-weight: 700 !important;
}

/* 整站文字统一粗体（覆盖页面内 font-weight: normal / 400 / 500 / 600） */
html body,
html body *:not(script):not(style):not(br):not(hr) {
    font-weight: 700 !important;
}

/* Soft cards — do not shadow Bootstrap .container (looks like a gray layer behind the page) */
.table-card,
.table-wrapper,
.card,
.list-section,
.glass-card,
.info-panel,
.schedule-card,
.stat-box,
.top-toolbar,
.login-card,
.custom-modal,
.modal-card,
.hero-section {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06) !important;
}

/* Table rules visible on white */
th,
td {
    border-color: rgba(15, 23, 42, 0.16) !important;
}

/* ========== 全站：过长文字自动折行，避免叠字 ========== */
html body table {
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
}

html body th,
html body td {
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}

html body td:not(.col-action):not(.col-aact),
html body th:not(.col-action):not(.col-aact),
html body .cell-plain,
html body .info-val,
html body .info-item span,
html body .confirm-value,
html body .diff-content,
html body .user-name,
html body .agent-opt .nm,
html body .picked-item,
html body .review-block td,
html body .review-wrap,
html body .sn-display,
html body .error-value-box,
html body .note-cell,
html body .bank-name,
html body .btn-company,
html body .team-btn,
html body .agent-company,
html body .agent-company b {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-height: 1.3 !important;
}

/* 核对弹窗：整块居中（不撑满）+ 过长自动折行 */
html body .review-box {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}
html body #reviewContent,
html body .review-box > div {
    width: max-content !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}
html body .diff-list {
    display: grid !important;
    grid-template-columns: auto auto !important;
    gap: 12px 16px !important;
    width: max-content !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    align-items: start !important;
    text-align: left !important;
}
html body .diff-label {
    text-align: right !important;
    white-space: nowrap !important;
}
html body .diff-content,
html body .diff-content.one-line {
    max-width: min(260px, 52vw) !important;
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-height: 1.45 !important;
}

/* 核对弹窗（loan/borrower diff-item 结构）：整块居中 + 过长折行 */
html body #actionDiffBox .diff-container,
html body .diff-scroll-box .diff-container {
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr) 1.4em minmax(0, 1fr) !important;
    column-gap: 8px !important;
    row-gap: 10px !important;
    align-items: start !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}
html body .diff-item {
    display: contents !important;
}
html body .diff-vals {
    display: block !important;
    max-width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-height: 1.45 !important;
}
html body .diff-vals:has(.diff-arrow) {
    display: contents !important;
}
html body .diff-vals:not(:has(.diff-arrow)) {
    grid-column: 2 / -1 !important;
}
html body .diff-label {
    text-align: right !important;
    padding-top: 2px !important;
}
html body .diff-arrow {
    color: #64748b !important;
    text-align: center !important;
    padding-top: 2px !important;
}
html body .diff-old,
html body .diff-new {
    min-width: 0 !important;
    max-width: none !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

/* 操作列 / 按钮保持单行，不随内容折行 */
html body td.col-action,
html body th.col-action,
html body .col-action,
html body td.col-aact,
html body .col-aact,
html body .btn-action,
html body button.btn-action {
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
}

/* 空结果行：去掉「没有找到匹配的记录」下方那条底线 */
tr.empty-row td,
tr.empty-state td {
    border: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

/* Inputs readable on white */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    color: #0f172a !important;
}

/* Search / filter typed text always black on white */
.large-input,
.date-input,
#searchInput,
#icSearchInput,
#idSearchInput,
#searchInput.large-input,
#icSearchInput.large-input,
#idSearchInput.large-input,
input.large-input,
input.date-input {
    color: #0f172a !important;
}

/* Idle borders only: focus keeps blue; error classes no longer use red */
input:not([type="checkbox"]):not([type="radio"]):not(:focus),
select:not(:focus),
textarea:not(:focus) {
    border-color: rgba(15, 23, 42, 0.22) !important;
}

/* 取消全站 input 报错红框：只保留 focus 蓝边 */
input.input-err,
input.input-error,
textarea.input-err,
textarea.input-error,
.input-err,
.input-error,
.error-border,
.custom-select-wrapper.input-err,
.custom-select-wrapper.input-error,
.f-group.input-err,
.toggle-group.input-err {
    border-color: rgba(15, 23, 42, 0.22) !important;
    background-color: #ffffff !important;
    box-shadow: none !important;
}

input.input-err:focus,
input.input-error:focus,
textarea.input-err:focus,
textarea.input-error:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

/* Filter bar inputs: outer shell owns focus ring — no nested “小框” on the text field */
.filter-container .large-input,
.filter-container input:not([type="checkbox"]):not([type="radio"]),
.search-container .large-input,
.search-container input:not([type="checkbox"]):not([type="radio"]),
.search-shell .serial-input,
.search-shell input:not([type="checkbox"]):not([type="radio"]),
#searchInput.large-input,
#icSearchInput.large-input,
#idSearchInput.large-input,
#serialInput.serial-input,
.filter-container .large-input:focus,
.filter-container input:not([type="checkbox"]):not([type="radio"]):focus,
.search-container .large-input:focus,
.search-container input:not([type="checkbox"]):not([type="radio"]):focus,
.search-shell .serial-input:focus,
.search-shell input:not([type="checkbox"]):not([type="radio"]):focus,
.search-box input,
.search-box input:focus,
#searchInput.large-input:focus,
#icSearchInput.large-input:focus,
#idSearchInput.large-input:focus,
#serialInput.serial-input:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
}

/* Filter / select shells */
.filter-container,
.search-container,
.custom-select-wrapper,
.custom-options,
.toggle-group,
.next-code-preview,
.date-input,
.schedule-box,
.funding-list,
.step-options {
    border-color: rgba(15, 23, 42, 0.22) !important;
}

/* 普通表单下拉：从输入框底边往下开（贴框底） */
html body .custom-select-wrapper > .custom-options {
    top: 100% !important;
    margin-top: 0 !important;
}

/* filter 内下拉由 security.js 固定到 filter-container 底边（与日期一致） */

input::placeholder,
textarea::placeholder {
    color: #94a3b8 !important;
}

/* ========== Button palette: blue / red / white only ========== */
/* Blue = primary / confirm / save / continue */
.btn-add,
.btn-login,
.btn-save,
.btn-submit,
.btn-done,
.btn-primary,
.btn-success,
.btn-confirm,
.btn-modal-primary,
.btn-modal-success,
.btn-modal-confirm,
.btn-modal-alert,
.btn-warning,
.btn-pay,
.btn-modal-blue,
.profile-page-btn,
.swal-btn-confirm,
.btn-modal-ok,
.btn-desk-primary {
    background: #3b82f6 !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}

.btn-add:hover,
.btn-login:hover,
.btn-save:hover,
.btn-submit:hover,
.btn-done:hover,
.btn-primary:hover,
.btn-success:hover,
.btn-confirm:hover,
.btn-modal-primary:hover,
.btn-modal-success:hover,
.btn-modal-confirm:hover,
.btn-modal-alert:hover,
.btn-warning:hover,
.btn-pay:hover,
.btn-modal-blue:hover,
.profile-page-btn:hover,
.swal-btn-confirm:hover,
.btn-modal-ok:hover,
.btn-desk-primary:hover {
    background: #5a9fff !important;
    background-image: none !important;
    color: #fff !important;
}

/* Red = delete / danger / logout confirm */
.btn-delete,
.btn-del,
.btn-del-s,
.btn-danger,
.btn-modal-error,
.btn-modal-del,
.btn-reenter,
.btn-nav-confirm,
.logout-btn {
    background: #ef4444 !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #ef4444 !important;
}

.btn-delete:hover,
.btn-del:hover,
.btn-del-s:hover,
.btn-danger:hover,
.btn-modal-error:hover,
.btn-modal-del:hover,
.btn-reenter:hover,
.btn-nav-confirm:hover,
.logout-btn:hover {
    background: #f87171 !important;
    background-image: none !important;
    color: #fff !important;
}

/* White = cancel / secondary / back */
.btn-cancel,
.btn-secondary,
.btn-modal-cancel,
.btn-modal-secondary,
.btn-modify,
.btn-nav-cancel,
.swal-btn-cancel {
    background: #ffffff !important;
    background-image: none !important;
    color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.22) !important;
}

.btn-cancel:hover,
.btn-secondary:hover,
.btn-modal-cancel:hover,
.btn-modal-secondary:hover,
.btn-modify:hover,
.btn-nav-cancel:hover,
.swal-btn-cancel:hover {
    background: #f8fafc !important;
    color: #0f172a !important;
}

/* Soft table action chips */
.btn-detail,
.btn-edit,
.btn-edit-s,
.btn-action.btn-detail,
.btn-action.btn-edit {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #3b82f6 !important;
    border: none !important;
}
.btn-detail:hover,
.btn-edit:hover,
.btn-edit-s:hover {
    background: #3b82f6 !important;
    color: #fff !important;
}

.btn-action.btn-delete,
.btn-action.btn-del,
.btn-del.btn-action {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}
.btn-action.btn-delete:hover,
.btn-action.btn-del:hover,
.btn-del.btn-action:hover {
    background: #ef4444 !important;
    color: #fff !important;
}

/* Popup footers: equal-size buttons, readable font */
.modal-footer,
.modal-btns,
.modal-btn-group,
.logout-modal-btns,
.custom-modal > div[style*="display: flex"],
.modal-card > div[style*="display: flex"] {
    display: flex !important;
    gap: 12px !important;
    align-items: stretch !important;
}

.modal-footer > .modal-btn,
.modal-footer > a.modal-btn,
.modal-footer > button,
.modal-footer > a,
.modal-btns > .btn-modal,
.modal-btns > button,
.modal-btn-group > .btn-modal,
.modal-btn-group > button,
.logout-modal-btns > button,
.custom-modal > div[style*="display: flex"] > .modal-btn,
.custom-modal > div[style*="display: flex"] > button,
.custom-modal > div[style*="display: flex"] > a,
.modal-card > div[style*="display: flex"] > button,
.modal-card > div[style*="display: flex"] > .btn-modal-secondary,
.modal-card > div[style*="display: flex"] > .btn-modal-primary,
.modal-card > div[style*="display: flex"] > .btn-modal-error,
.modal-overlay .modal-card form > div[style*="display: flex"] > button {
    flex: 1 1 0 !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    min-height: 48px !important;
    padding: 12px 10px !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

/* Popup message text: black */
.modal-card #alertMsg,
.modal-overlay #alertMsg,
#alertMsg {
    color: #0f172a !important;
}

/* 可点单号：蓝色、悬停无下划线 */
a.serial-link,
a.sn-link,
a.cell-plain[href] {
    color: #3b82f6 !important;
    text-decoration: none !important;
    border-bottom: none !important;
}
a.serial-link:hover,
a.serial-link:focus,
a.serial-link:visited,
a.sn-link:hover,
a.sn-link:focus,
a.sn-link:visited,
a.cell-plain[href]:hover,
a.cell-plain[href]:focus,
a.cell-plain[href]:visited {
    color: #3b82f6 !important;
    text-decoration: none !important;
    border-bottom: none !important;
}

/* ========== 全站按钮 hover ========== */
button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.toggle-btn,
.add-btn,
.filter-btn,
.btn-desk,
.btn-row-edit,
.btn-profile,
.btn-agent-count,
.custom-select-trigger,
.btn-action {
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease,
        transform 0.2s ease, filter 0.2s ease, border-color 0.2s ease;
}

button:disabled,
button[disabled],
input[type="submit"]:disabled,
input[type="button"]:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none !important;
    box-shadow: none !important;
}

button:hover:not(:disabled):not([disabled]):not(.reset-circle):not(.clear-x):not(.reset-link),
input[type="submit"]:hover:not(:disabled),
input[type="button"]:hover:not(:disabled),
input[type="reset"]:hover:not(:disabled),
.add-btn:hover,
.filter-btn:hover:not(.active),
.btn-desk:hover,
.btn-row-edit:hover,
.btn-profile:hover,
.btn-agent-count:hover,
.custom-select-trigger:hover,
.btn-action:hover,
.toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.add-btn:hover {
    background: rgba(59, 130, 246, 0.08) !important;
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
}

.toggle-btn:hover:not(.active) {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.filter-btn:hover:not(.active) {
    background: rgba(59, 130, 246, 0.08);
    color: #3b82f6;
}

.reset-circle,
.reset-link,
.clear-x {
    width: 24px;
    height: 24px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.1);
    color: var(--text-light, #0f172a) !important;
    border-radius: 50%;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    padding: 0;
    transition: 0.3s;
    cursor: pointer;
    border: none !important;
    outline: none;
}

button.reset-circle:hover:not(:disabled),
a.reset-link:hover,
button.clear-x:hover,
.reset-circle:hover,
.reset-link:hover,
.clear-x:hover {
    background: var(--rose, #f43f5e);
    color: var(--text-light, #0f172a) !important;
    transform: rotate(90deg);
    box-shadow: none !important;
}

.contact-row .clear-x,
#contact-list .clear-x {
    width: 18px;
    height: 18px;
    font-size: 8px;
}

.btn-desk-success:hover {
    filter: brightness(1.08);
}

.btn-desk-ghost:hover {
    background: #f8fafc !important;
    color: #0f172a !important;
}

.btn-row-edit:hover {
    background: #3b82f6 !important;
    color: #fff !important;
}
