* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Shared application typography; document/print content keeps its own styles. */
:root {
    --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --ui-text: 0.85rem;
    --ui-small: 0.75rem;
    --ui-control-height: 2rem;
    --ui-button-padding-x: 1rem;
    --ui-input-padding-x: 0.8rem;
    --ui-control-gap: 0.5rem;
    --ui-control-radius: 4px;
    --ui-compact-height: 1.5rem;
    --ui-compact-padding-x: 0.6rem;
}
button, input, select, textarea { font-family: inherit; }
/* Links keep their existing colors and focus outlines without underlines. */
a, a:link, a:visited, a:hover, a:focus, a:active, a * {
    text-decoration: none !important;
}

html.px-product-picker-open { overflow:hidden !important; overscroll-behavior:none; }
html.px-product-picker-gutter { scrollbar-gutter:stable; }
.li-picker-menu, .li-picker-menu .li-menu-col, .ss-dropdown, .lo-modal-rows, .settlement-menu { overscroll-behavior-y:contain; }
body {
    font-family: var(--ui-font);
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.navbar {
    background: #1a1a2e;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 56px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .brand {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    margin-right: 2rem;
}

.navbar .nav-links {
    display: flex;
    gap: 0.5rem;
}

.navbar .nav-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.navbar .nav-links a:hover,
.navbar .nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.navbar .nav-right {
    margin-left: auto;
}

.navbar .nav-right a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: var(--ui-text);
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    transition: all 0.2s;
}

.navbar .nav-right a:hover {
    color: #fff;
    border-color: #fff;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

h1.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1a1a2e;
}

/* Dashboard cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid #1a1a2e;
}

.stat-card.blue { border-left-color: #1890ff; }
.stat-card.green { border-left-color: #52c41a; }
.stat-card.orange { border-left-color: #fa8c16; }
.stat-card.red { border-left-color: #f5222d; }
.stat-card.purple { border-left-color: #722ed1; }

.stat-card .label {
    font-size: var(--ui-text);
    color: #888;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-card .value.money::before {
    content: '\A5';
    font-size: 1rem;
    margin-right: 2px;
}

/* Tables */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* 列表页顶部一排：筛选、搜索靠左，新增/导出/上传这类动作按钮统一推到最右 */
.hdr-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.hdr-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.search-form input[type="search"] { width:180px; }
.search-form > .btn { flex-shrink:0; }

.search-form input[type="text"],
.search-form input[type="search"],
.search-form select {
    padding: 0 var(--ui-input-padding-x);
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: var(--ui-text);
    outline: none;
    transition: border-color 0.2s;
}

/* Control geometry is owned here; page layouts must not override it. */
.search-form input[type="text"],
.search-form input[type="search"],
.search-form select,
.search-form button,
.card-header select,
.card-header input[type="text"] {
    height: var(--ui-control-height);
    box-sizing: border-box;
}

.search-form input[type="text"]:focus,
.search-form input[type="search"]:focus,
.search-form select:focus {
    border-color: #1890ff;
}

.search-form button:not(.btn) {
    padding: 0.4rem 1rem;
    background: #1890ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--ui-text);
    transition: background 0.2s;
}

.search-form button:not(.btn):hover {
    background: #096dd9;
}

.table-wrap {
    overflow-x: auto;
}

/* 列表页：筛选行 + 表头冻结。整页单滚动条（外侧），导航栏/筛选行/表头由 base.html
   脚本设为 viewport sticky；此处只去掉内层滚动容器并给表头留分隔线。 */
.table-wrap.list-table {
    overflow: visible;
}
.table-wrap.list-table thead th {
    box-shadow: inset 0 -1px 0 #f0f0f0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: #fafafa;
    font-weight: 600;
    font-size: var(--ui-text);
    color: #555;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #f5f5f5;
    font-size: var(--ui-text);
    color: #333;
}

table tr:hover {
    background: #fafafa;
}

table .money {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

table .empty {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 10px;
    font-size: var(--ui-small);
    font-weight: 500;
}

.badge-category {
    background: #e6f7ff;
    color: #1890ff;
    white-space: nowrap;
}

/* Order type badges identify the saved shipment sender; keep other badges unchanged. */
.badge-shipping-sender {
    background: #f2f3f5;
    color: #424b57;
    white-space: nowrap;
}
.badge-shipping-sender-px {
    background: #eaf2fb;
    color: #254b75;
}
.badge-shipping-sender-hy {
    background: #fff0ef;
    color: #a82a28;
}

/* 日期一律 YYYY-MM-DD 且不换行（列窄时宁可横向滚动，不拆成两行） */
.nowrap,
td.date-cell,
th.date-cell {
    white-space: nowrap;
}

.text-muted {
    color: #999;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--ui-control-height);
    box-sizing: border-box;
    padding: 0 calc(var(--ui-button-padding-x) - 1px);
    border: 1px solid transparent;
    border-radius: var(--ui-control-radius);
    cursor: pointer;
    font-family: var(--ui-font);
    font-size: var(--ui-text);
    font-weight: 400;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1.5;
    white-space: nowrap;
}

/* 整宽大按钮（登录页）不吃统一高度 */
.btn-block {
    display: flex;
    width: 100%;
    height: auto;
    padding: 0.6rem;
    font-size: 1rem;
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #096dd9;
}

.btn-save-exit { background:#52c41a; color:#fff; }
.btn-save-exit:hover { background:#389e0d; }
.btn-secondary { background:#f0f0f0; color:#555; }
.btn-secondary:hover { background:#d9d9d9; }

.btn-cancel {
    background: #f0f0f0;
    color: #555;
}

.btn-cancel:hover {
    background: #d9d9d9;
}

.btn-icon {
    width: var(--ui-control-height);
    padding: 0 !important;
    flex-shrink: 0;
}
.btn-icon > svg { width:19px; height:19px; flex-shrink:0; }

.btn-danger {
    background: #f5222d;
    color: #fff;
}

.btn-danger:hover {
    background: #cf1322;
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--ui-compact-height);
    padding: 0 var(--ui-compact-padding-x);
    border: none;
    border-radius: var(--ui-control-radius);
    font-family: var(--ui-font);
    font-size: var(--ui-small);
    font-weight: 400;
    line-height: 1.5;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-edit {
    background: #e6f7ff;
    color: #1890ff;
}

.btn-edit:hover {
    background: #bae7ff;
}

.btn-move {
    background: #f0f0f0;
    color: #595959;
    width: var(--ui-compact-height);
    padding: 0;
    line-height: 1;
}

.btn-move:hover:not(:disabled) {
    background: #d9d9d9;
}

.btn-move:disabled {
    opacity: 0.3;
    cursor: default;
}

.btn-delete {
    background: #fff2f0;
    color: #f5222d;
}

.btn-delete:hover {
    background: #ffccc7;
}

.actions {
    white-space: nowrap;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: var(--ui-text);
    font-weight: 600;
    color: #555;
    margin-bottom: 0.3rem;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.8rem;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: var(--ui-text);
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.1);
}

input.form-input, select.form-input {
    height: var(--ui-control-height);
    padding: 0 var(--ui-input-padding-x);
    line-height: 1.5;
}

select.form-input {
    appearance: auto;
}

textarea.form-input {
    resize: vertical;
}

.form-error {
    color: #f5222d;
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

.form-actions {
    display: flex;
    gap: var(--ui-control-gap);
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

/* Detail table */
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table th {
    text-align: left;
    padding: 0.6rem 1rem;
    background: #fafafa;
    font-size: var(--ui-text);
    font-weight: 600;
    color: #555;
    width: 120px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
    white-space: nowrap;
}

.detail-table td {
    padding: 0.6rem 1rem;
    font-size: var(--ui-text);
    color: #333;
    border-bottom: 1px solid #f5f5f5;
}

/* User dropdown */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-dropdown-trigger {
    color: rgba(255,255,255,0.75);
    font-size: var(--ui-text);
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    transition: all 0.2s;
    user-select: none;
}

.user-dropdown-trigger:hover {
    color: #fff;
    border-color: #fff;
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 120px;
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown:hover .user-dropdown-menu {
    display: block;
}

.navbar .nav-right .user-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: var(--ui-text);
    transition: background 0.2s;
    border: none;
}

.navbar .nav-right .user-dropdown-menu a:hover {
    background: #e6f7ff;
    color: #1890ff;
}

.stat-card.teal { border-left-color: #13c2c2; }

/* Responsive */
@media (max-width: 768px) {
    :root { --ui-text: 0.78rem; --ui-button-padding-x: 0.6rem; }
    .navbar {
        padding: 0 0.5rem;
        flex-wrap: wrap;
        height: auto;
        min-height: 48px;
    }
    .navbar .brand {
        font-size: 1rem;
        margin-right: 0.5rem;
    }
    .navbar .nav-links {
        gap: 0;
        flex-wrap: wrap;
    }
    .navbar .nav-links a {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }
    .container {
        padding: 0.8rem 0.5rem;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .stat-card {
        padding: 0.8rem;
    }
    .stat-card .value {
        font-size: 1.2rem;
    }
    .card-header {
        padding: 0.6rem 0.8rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .card-header h2 {
        font-size: 0.95rem;
    }
    table th, table td {
        padding: 0.5rem 0.5rem;
        font-size: var(--ui-text);
    }
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .form-actions {
        flex-wrap: wrap;
    }
    .search-form {
        flex-wrap: nowrap;
    }
    .search-form input[type="search"], #fund-filters input[type="search"] { width:140px; }
    .search-form input[type="text"],
    .search-form input[type="search"] {
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .navbar .nav-links a {
        padding: 0.25rem 0.4rem;
        font-size: var(--ui-small);
    }
}

/* ========== 内部资料文档样式（.doc-article 作用域） ========== */
/* 同时适用于查看页（.content-readonly .doc-article）和 CKEditor 编辑页（.ck-content .doc-article） */
.doc-article h1 { text-align: center; border-bottom: 2px solid #444; padding-bottom: 0.4em; margin: 0.6em 0; }
.doc-article h2 { border-left: 5px solid #1a73e8; padding-left: 0.6em; margin-top: 1.4em; margin-bottom: 0.6em; }
.doc-article h3 { color: #1a73e8; margin-top: 1em; margin-bottom: 0.5em; }
.doc-article table { border-collapse: collapse; width: 100%; margin: 0.8em 0; }
.doc-article table th, .doc-article table td { border: 1px solid #bbb; padding: 0.45em 0.75em; text-align: left; vertical-align: top; }
.doc-article table th { background: #f4f6f8; }
.doc-article .doc-subtitle { text-align: center; color: #666; font-size: 0.9em; margin-bottom: 1em; }
.doc-article .doc-callout-tip { background: #e8f0fe; border-left: 4px solid #1a73e8; padding: 0.6em 1em; margin: 0.8em 0; }
.doc-article .doc-callout-warn { background: #fff4e5; border-left: 4px solid #f59e0b; padding: 0.6em 1em; margin: 0.8em 0; }
.doc-article .doc-callout-danger { background: #fdecea; border-left: 4px solid #d93025; padding: 0.6em 1em; margin: 0.8em 0; }
.doc-article .doc-tag-hp { color: #b7410e; font-weight: bold; }
.doc-article .doc-tag-ap { color: #0b6e4f; font-weight: bold; }
.doc-article .doc-tag-mc { color: #6b46c1; font-weight: bold; }
.doc-article hr { border: none; border-top: 1px solid #ddd; margin: 1.2em 0; }
.doc-article .doc-footer { text-align: center; color: #888; font-size: 0.9em; }

/* 上传发票页：与报销站 static/css/style.css 的 Upload zone / Upload result list 两段逐字一致，页面脚本两站共用 */
/* Upload zone */
.upload-zone {
    border: 2px dashed #d9d9d9;
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
    margin-bottom: 1.5rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #1890ff;
    background: #e6f7ff;
}

.upload-zone p {
    color: #888;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.upload-zone .hint {
    font-size: 0.8rem;
    color: #bbb;
}

/* Upload result list */
.upload-results {
    list-style: none;
}

.upload-results li {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: var(--ui-text);
}

.upload-results li .status-icon {
    font-size: 1.2rem;
}

.upload-results li .info { flex: 1; }
.upload-results li .info .name { font-weight: 600; }
.upload-results li .info .detail { color: #888; font-size: 0.8rem; }

/* 筛选按钮选中态（红）：订单总表「整机配耗 / 售后维修」与开票明细「未关联记录 / 隐藏红冲」共用 */
.btn-type-active { background: #f5222d; color: #fff; }
.btn-type-active:hover { background: #cf1322; }

.catalog-tabs { display:flex; gap:0.5rem; align-items:center; flex-wrap:wrap; }
.catalog-tabs .tab-btn { white-space:nowrap; }
.catalog-tabs .tab-btn.active { background:#1890ff; color:#fff; }
.catalog-tabs .tab-btn:not(.active):not(.btn-type-active),
.catalog-tabs .service-tab:not(.btn-type-active) { background:#f0f0f0; color:#555; }
.catalog-divider { height:24px; border-left:1px solid #d9d9d9; margin:0 0.3rem; }
.service-menu { position:relative; }
.service-menu > summary { list-style:none; cursor:pointer; }
.service-menu > summary::-webkit-details-marker { display:none; }
.service-menu-arrow { display:inline-block; margin-left:8px; }
.service-menu[open] .service-menu-arrow { transform:rotate(180deg); }
.service-menu-options { position:absolute; top:calc(100% + 6px); left:0; z-index:20; min-width:100%; padding:4px; border:1px solid #e8e8e8; border-radius:6px; background:#fff; box-shadow:0 4px 12px rgba(0,0,0,.12); }
.service-menu-options a { display:block; padding:9px 14px; border-radius:4px; color:#333; white-space:nowrap; text-decoration:none; }
.service-menu-options a:hover, .service-menu-options a:focus-visible { background:#f5f5f5; }
.service-menu-options a[aria-current="page"] { background:#fff1f0; color:#cf1322; }
.service-list-title { margin:0; padding:12px 16px; font-size:1rem; font-weight:600; }
.service-detail { margin-top:6px; max-width:660px; white-space:normal; }
.service-detail summary { color:#666; cursor:pointer; font-size:var(--ui-text); }
.service-detail p { margin:6px 0; line-height:1.6; }
.service-summary { margin-top:5px; color:#666; font-size:var(--ui-text); white-space:normal; }
.service-table td:first-child { min-width:140px; }
.service-table .service-name { min-width:230px; }
.service-table .service-scope { min-width:240px; max-width:500px; white-space:normal; }
.service-form { padding:1.5rem; max-width:800px; display:grid; gap:1rem; }
.service-form .errorlist { color:#f5222d; margin:4px 0; }
@media (max-width:700px) { .catalog-tabs { gap:var(--ui-control-gap); } }


/* Keep text columns readable on narrow screens; scroll the table as a whole. */
.order-list-table table { min-width:1200px; }
.order-list-table th:nth-child(3), .order-list-table td:nth-child(3) { min-width:140px; }
.order-list-table th:nth-child(4), .order-list-table td:nth-child(4) { min-width:240px; }
.invoice-list-table table { min-width:1100px; }

/* Funds ledger layout and shared list components */
.funds-card, .bank-import-card { font-family:var(--ui-font); font-size:var(--ui-text); }
.funds-card .card-header { display:block; padding:12px 16px; overflow-x:auto; }
#fund-filters { display:flex; flex-wrap:nowrap; align-items:center; gap:var(--ui-control-gap); width:max-content; min-width:100%; }
#fund-filters > * { flex-shrink:0; }
#fund-filters .form-input, #fund-filters .btn { height:var(--ui-control-height); margin:0; box-sizing:border-box; }
#fund-filters .list-search-input input[type="search"] { padding-right:58px; }
#fund-filters [name="year"] { width:94px; }
#fund-filters [name="kind"] { width:180px; }
#fund-filters [name="company"], #fund-filters [name="account"] { width:150px; }

#fund-filters label { display:flex; align-items:center; gap:4px; white-space:nowrap; }
#fund-filters .hdr-actions { margin-left:0; padding-left:4px; }
.funds-card table { min-width:1100px; }
.funds-card table th:nth-child(3) { min-width:160px; }
.funds-card .funds-muted { color:#777; }
.funds-card .funds-income { color:#167344; }
.funds-card .funds-expense { color:#c53030; }
.funds-card .link-order-cell { white-space:nowrap; }

#fund-filters .form-input, #fund-filters label { font-size:var(--ui-text); }
.pagination { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:12px 16px; border-top:1px solid #f0f0f0; font-size:var(--ui-text); color:#666; }
.pagination form, .pagination-links { display:flex; gap:var(--ui-control-gap); align-items:center; flex-wrap:wrap; }
.pagination select, .pagination input { width:auto; height:var(--ui-control-height); padding:0 var(--ui-input-padding-x); font-family:var(--ui-font); font-size:var(--ui-text); border:1px solid #d9d9d9; border-radius:var(--ui-control-radius); }
.pagination input { width:64px; }
.pagination .disabled { color:#aaa; cursor:default; }
.pagination .current { font-weight:600; }

.funds-balance { margin-left:auto; color:#666; white-space:nowrap; font-size:var(--ui-text); }
.date-range-panel { position:fixed; z-index:1500; width:290px; max-width:calc(100vw - 16px); padding:14px; border:1px solid #d9d9d9; border-radius:6px; background:#fff; box-shadow:0 4px 18px rgba(0,0,0,.16); font-size:var(--ui-text); }
.date-range-panel[hidden] { display:none; }
#date-range-title { font-weight:600; margin-bottom:10px; }
.date-range-panel label { display:block; margin:8px 0 4px; }
.date-range-panel .form-input { height:var(--ui-control-height); }
.date-range-field { position:relative; }
.date-range-field > .form-input { padding-right:calc(var(--ui-control-height) + var(--ui-input-padding-x)); }
.date-range-picker { position:absolute; top:0; right:0; width:var(--ui-control-height); height:100%; display:flex; align-items:center; justify-content:center; color:#666; border-radius:var(--ui-control-radius); }
.date-range-picker:focus-within { outline:2px solid #1890ff; outline-offset:-2px; }
.date-range-native { position:absolute; inset:0; width:100%; height:100%; min-width:0; padding:0; border:0; opacity:0; cursor:pointer; }
.date-range-native::-webkit-calendar-picker-indicator { position:absolute; inset:0; width:100%; height:100%; margin:0; padding:0; cursor:pointer; }
.date-range-actions { display:flex; justify-content:flex-end; gap:var(--ui-control-gap); margin-top:12px; }
@media (max-width:768px) { .funds-balance { margin-left:0; } }

/* Settlement accounts use the same small control in forms and list headers. */
.settlement-customer { display:flex; align-items:center; gap:6px; }
.settlement-customer > .form-input { flex:1; min-width:0; }
.settlement-button { position:relative; }
.settlement-button.selected { background:#1890ff; color:#fff; }
.settlement-count { position:absolute; top:-5px; right:-5px; border-radius:9px; background:#f5222d; color:white; min-width:15px; padding:1px 3px; font-size:var(--ui-small); line-height:1.2; }
.settlement-count[hidden] { display:none; }
.settlement-menu { position:fixed; z-index:2100; width:340px; max-width:calc(100vw - 16px); max-height:360px; overflow-y:auto; background:white; border:1px solid #ddd; border-radius:5px; box-shadow:0 5px 20px #0002; padding:4px; }
.settlement-option { width:100%; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 10px; border:0; border-radius:3px; text-align:left; background:white; color:#333; cursor:pointer; font:inherit; font-size:var(--ui-text); }
.settlement-option:hover, .settlement-option:focus-visible { background:#e6f7ff; }
.settlement-option small { display:block; color:#777; font-size:var(--ui-small); }
.settlement-owed { color:#c53030; }
.settlement-heading { display:flex; flex-wrap:wrap; align-items:center; gap:8px; width:100%; }
.settlement-heading .form-input { width:260px; max-width:100%; }
.settlement-heading-summary { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:8px 24px; margin-left:auto; font-size:var(--ui-text); color:#666; }
.settlement-heading-summary > span { white-space:nowrap; }
.settlement-heading-summary strong { font-variant-numeric:tabular-nums; }
.settlement-positive { color:#167344; }
.settlement-gap { color:#b45309; }
@media(max-width:700px) { .settlement-heading-summary { width:100%; } }

.settlement-summary { display:flex; gap:12px 32px; flex-wrap:wrap; padding:12px 16px; font-size:var(--ui-text); }
.settlement-orders { margin-top:1rem; }
.settlement-create { padding:1.5rem; max-width:500px; }

.invoice-records table { min-width:1000px; }
.payment-records table { min-width:760px; }
.settlement-orders table { min-width:640px; }
.financial-records .actions, .settlement-orders td:last-child { white-space:nowrap; }

/* Settlement deductions and inline account details reuse global text/control sizes. */
.settlement-expenses[hidden], .settlement-detail[hidden] { display:none; }
.expense-table { min-width:720px; table-layout:fixed; }
.expense-table .money { width:145px; }
.expense-table .expense-actions { width:100px; white-space:nowrap; text-align:center; }
.expense-table input { font-size:var(--ui-text); }
.expense-table .money input { text-align:right; }
.expense-drag-handle { border:0; background:none; font-family:inherit; }
.expense-move { border:0; border-radius:3px; background:none; color:#888; cursor:pointer; padding:2px 5px; font:inherit; }
.expense-move:hover { background:#e6f7ff; color:#1890ff; }
.expense-move:disabled { color:#ddd; cursor:default; background:none; }
.expense-table tr[draggable] { user-select:auto; }
.expense-summary { justify-content:flex-end; flex-wrap:wrap; font-size:var(--ui-text); }
.settlement-breakdown { padding:12px; background:#fafafa; }
.settlement-breakdown > strong { display:block; margin:8px 0; }
.settlement-breakdown table { background:white; margin-bottom:10px; }
.settlement-detail-toggle { cursor:pointer; font-family:inherit; border:0; }
.list-search-input { position:relative; display:inline-flex; flex-shrink:0; }
.search-form .list-search-input input[type="search"] { padding-right:58px; }
.search-form .list-search-submit.btn, #fund-filters .list-search-submit.btn { position:absolute; right:1px; top:1px; display:inline-flex; align-items:center; justify-content:center; height:calc(var(--ui-control-height) - 2px); width:30px; padding:0; border:0; border-radius:0 3px 3px 0; color:#777; background:transparent; }
.search-form .list-search-submit.btn:hover { color:#1890ff; background:#e6f7ff; }
.list-filter-group { display:inline-flex; align-items:center; flex-shrink:0; }
.list-filter-group > .btn { border-radius:4px 0 0 4px; }
.list-filter-group > .list-filter-reset, #fund-filters .list-filter-reset { display:inline-flex; align-items:center; justify-content:center; width:30px; padding-left:0; padding-right:0; border-radius:0 4px 4px 0; border-left:1px solid #d9d9d9; }
.list-filter-group.is-active > .list-filter-reset { border-left-color:rgba(255,255,255,.45); }
.list-sort-group { display:inline-flex; border-left:1px solid #e8e8e8; padding-left:8px; margin-left:4px; }
@media (max-width:700px) {
    .card:has(.list-table) > .card-header { max-width:calc(100vw - 1rem); }
    .card-header .hdr-row { min-width:0; max-width:100%; }
    .card-header .search-form { flex-wrap:wrap; max-width:100%; }
    .card-header #fund-filters { flex-wrap:wrap; width:100%; min-width:0; }
}

/* Shared advanced search, using the list controls' typography and spacing. */
#advanced-dialog { position:fixed; inset:auto; left:50%; transform:translateX(-50%); margin:0; width:680px; max-width:calc(100vw - 32px); box-sizing:border-box; max-height:85vh; overflow:auto; border:1px solid #d9d9d9; border-radius:6px; padding:18px; font:inherit; font-size:var(--ui-text); color:#333; }
#advanced-dialog::backdrop { background:rgba(0,0,0,.35); }
.advanced-heading, .advanced-footer { display:flex; align-items:center; gap:8px; }
.advanced-heading { justify-content:space-between; margin-bottom:16px; }
.advanced-footer { margin-top:18px; }
.advanced-footer span { flex:1; }
.advanced-match-label { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
#advanced-dialog .form-input { width:100%; min-width:0; margin:0; }
.advanced-match-label select { max-width:180px; }
.advanced-row { display:grid; grid-template-columns:1.25fr 1fr 1.5fr auto; gap:8px; margin-bottom:10px; align-items:center; }
.advanced-value-wrap { min-width:0; }
.advanced-error { color:#cf1322; white-space:normal; }
@media(max-width:600px) { .advanced-row { grid-template-columns:1fr 1fr auto; } .advanced-value-wrap { grid-row:2; grid-column:1 / 3; } .advanced-row > button { grid-row:1 / 3; grid-column:3; } }

/* Company transfers: summary first, details loaded only when expanded. */
.transfers-card { font-size:var(--ui-text); }
.transfers-card .transfer-table-wrap { overflow-x:auto; }
.transfers-card .card-header { display:block; padding:12px 16px; overflow-x:auto; }
.transfer-heading { display:flex; align-items:center; flex-wrap:wrap; gap:12px; padding:16px; }
.transfer-heading h2 { font-size:var(--ui-text); font-weight:600; margin:0; }
.transfer-heading > span, .transfer-muted, .transfer-count { color:#777; font-size:var(--ui-text); }
.transfer-heading > span { margin-left:auto; }
.transfer-summary { table-layout:fixed; min-width:720px; }
.transfer-summary > thead > tr > th:first-child { width:46%; }
.transfer-summary > thead > tr > th:not(:first-child) { width:18%; }
.transfer-counterparties > thead > tr > th { background:#eaf3ff; }
.transfer-counterparties > tbody > .transfer-summary-row > td { background:#f4f9ff; }
.transfer-counterparties > tbody > .transfer-summary-row:hover > td { background:#eaf3ff; }
.transfer-toggle { display:flex; align-items:center; gap:8px; color:inherit; text-decoration:none; min-height:24px; }
.transfer-toggle:hover, .transfer-source a:hover { color:#1677ff; }
.transfer-chevron { display:inline-block; width:12px; color:#1677ff; transition:transform .15s; }
.transfer-toggle[aria-expanded="true"] .transfer-chevron { transform:rotate(90deg); }
.transfer-count { margin-left:auto; white-space:nowrap; }
.transfer-inactive { padding-left:20px; color:#777; }
.transfer-positive { color:#167344; font-weight:600; }
.transfer-negative { color:#c53030; font-weight:600; }
.transfer-expanded-row[hidden] { display:none; }
.transfer-expanded-row > td { padding:0 16px 14px 28px; background:#f6f8fb; }
.transfer-panel { border:1px solid #e2e8f0; border-radius:6px; background:#fff; margin-top:10px; overflow:hidden; }
.transfer-caption { padding:12px 14px; display:flex; align-items:center; flex-wrap:wrap; gap:12px; font-weight:600; }
.transfer-caption > span { color:#777; font-weight:400; margin-left:auto; }
.transfer-transactions { min-width:1050px; }
.transfer-transactions th:nth-child(2), .transfer-transactions th:nth-child(3) { min-width:180px; }
.transfer-note { min-width:160px; overflow-wrap:anywhere; }
.transfer-source { white-space:nowrap; }
.transfer-source a, .transfer-source span { display:block; margin:3px 0; }
.transfer-source a { color:#1677ff; text-decoration:none; }
.transfer-unverified, .transfer-notice { color:#b45309; }
.transfer-notice { padding:0 16px 12px; }
.transfer-panel[aria-busy="true"] { opacity:.65; }
@media (max-width:768px) {
 .transfer-expanded-row > td { padding:0 8px 10px; }
 .transfer-heading > span, .transfer-caption > span { margin-left:0; }
}

/* Whole-record actions on edit pages: danger first, separated from routine actions. */
.edit-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:var(--ui-control-gap); margin-left:auto; min-width:0; }
.edit-actions .btn { white-space:nowrap; flex-shrink:0; }
.card-header:has(> .edit-actions) { flex-wrap:wrap; gap:0.8rem; }
.edit-danger-action { display:inline-flex; align-items:center; border-right:1px solid #e8e8e8; padding-right:0.8rem; margin-right:0.2rem; }
.edit-danger-action[hidden] { display:none; }
.edit-danger-action form { margin:0; }
.btn-danger-outline { background:#fff; color:#cf1322; border:1px solid #ff7875; }
.btn-danger-outline:hover { background:#fff1f0; color:#a8071a; border-color:#cf1322; }
.btn-danger-outline:disabled { opacity:0.5; cursor:not-allowed; }
.delete-record-id { color:#666; margin-bottom:1.5rem; }
@media(max-width:768px) {
    .card-header .edit-actions { width:100%; gap:0.5rem; }
    .edit-danger-action { padding-right:0.65rem; margin-right:0.15rem; }
}

/* Explicit company-pair accounts share the funds typography and table controls. */
.intercompany-card { font-family:var(--ui-font); font-size:var(--ui-text); }
.intercompany-card .transfer-heading { flex-wrap:nowrap; gap:8px; padding:14px 16px 10px; }
.intercompany-card .transfer-heading h2 { flex-shrink:0; }
.intercompany-heading-actions { display:flex; align-items:center; flex-shrink:0; gap:12px; margin-left:auto; white-space:nowrap; }
.intercompany-show-all { color:#1677ff; white-space:nowrap; text-decoration:none; }
.intercompany-register-link, .intercompany-register-link:hover { color:#1890ff; text-decoration:none; }
.intercompany-tabs-row { display:flex; align-items:flex-start; gap:12px; padding:0 16px 14px; }
.intercompany-tabs { display:flex; flex:1; min-width:0; flex-wrap:wrap; gap:6px; }
.intercompany-invoice-hint { flex-shrink:0; max-width:100%; margin-left:auto; padding:5px 0; font-size:var(--ui-text); line-height:1.4; white-space:nowrap; }
.intercompany-invoice-hint strong { font-size:inherit; font-weight:600; white-space:nowrap; }
.intercompany-tab { display:inline-block; border:1px solid #d9d9d9; border-radius:4px; background:#fafafa; color:#444; padding:5px 9px; text-decoration:none; white-space:nowrap; font-size:var(--ui-text); line-height:1.4; }
.intercompany-tab:hover { border-color:#91caff; background:#f0f7ff; }
.intercompany-tab.is-empty { color:#888; background:#fff; }
.intercompany-tab.active { color:#0958d9; background:#e6f4ff; border-color:#91caff; }
.intercompany-red-invoice { color:#888; }
.intercompany-card .money { white-space:nowrap; }
.intercompany-card .transfer-notice { margin:0; font-size:var(--ui-text); font-weight:400; }
.intercompany-pagination { gap:10px; flex-wrap:wrap; }
.intercompany-empty { padding:24px 16px; }
@media(max-width:768px) {
 .intercompany-tabs-row { flex-wrap:wrap; padding-left:12px; padding-right:12px; }
 .intercompany-tabs { flex-basis:100%; }
 .intercompany-invoice-hint { padding:0; white-space:normal; }
 .intercompany-tab { padding:4px 7px; }
 .intercompany-pagination .pagination-links { flex-wrap:wrap; }
}

.intercompany-card table.is-empty { min-width:0; }
.intercompany-card table.is-empty thead { display:none; }
.intercompany-card table.is-empty .empty { text-align:center; padding:24px 16px; }

/* 已存主资料默认查看，文字仍可选择复制。 */
.record-view input[readonly], .record-view textarea[readonly] {
    background:#f5f5f5; border-color:#d9d9d9; color:inherit; box-shadow:none;
}
.record-view select:disabled, .record-view input:disabled, .record-view textarea:disabled {
    opacity:1; color:inherit; -webkit-text-fill-color:currentColor;
}
.record-view [data-record-main] [data-record-mutate] { cursor:default; }
.record-view .record-readonly-control {
    background-color:#f5f5f5 !important; border-color:#d9d9d9 !important;
    color:inherit; opacity:1; box-shadow:none !important; -webkit-text-fill-color:currentColor;
}
.record-view select.record-readonly-control {
    appearance:none !important; -webkit-appearance:none !important;
    -moz-appearance:none !important; background-image:none !important;
}
.record-view .record-readonly-control.li-picker::after,
.record-view .record-readonly-choice::after { display:none !important; }
.record-view select.li-tier-select { opacity:0; pointer-events:none; }
.record-view input.record-readonly-control[type="number"] { -moz-appearance:textfield; }
.record-view input.record-readonly-control::-webkit-inner-spin-button,
.record-view input.record-readonly-control::-webkit-outer-spin-button,
.record-view input.record-readonly-control::-webkit-calendar-picker-indicator { appearance:none; -webkit-appearance:none; display:none; }

/* 订单生产区与主资料分别保存，沿用页面字号和操作样式。 */
.order-production { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #e8e8e8; }
.order-production > h3 { font-size: var(--ui-text); margin: 0 0 1rem; }
.production-save-status { display: flex; align-items: center; gap: .5rem; min-height: 1.4em; margin-top: .25rem; color: #666; font-size: var(--ui-small); }
.production-save-status.is-error { color: #c53030; }
.production-save-status button { font-size: inherit; }
.production-save-status button[hidden], [data-record-edit-action][hidden] { display:none !important; }
