/* ============================================================
   客户查询管理工具 - 样式表
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #185FA5;
    --primary-light: #E6F1FB;
    --primary-dark: #0C447C;
    --danger: #C0392B;
    --danger-light: #FCEBEB;
    --success: #0F6E56;
    --success-light: #E1F5EE;
    --warning: #854F0B;
    --warning-light: #FAEEDA;
    --gray-50: #F8F9FA;
    --gray-100: #F1EFE8;
    --gray-200: #E5E5E5;
    --gray-300: #D3D1C7;
    --gray-400: #B4B2A9;
    --gray-500: #888780;
    --gray-600: #5F5E5A;
    --gray-700: #444441;
    --gray-800: #2C2C2A;
    --border: #E0E0E0;
    --border-hover: #B0B0B0;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
}

/* ============================================================
   登录页
   ============================================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.login-card h1 {
    font-size: 22px;
    font-weight: 500;
    color: var(--gray-800);
}

.login-subtitle {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 8px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--gray-400);
}

/* ============================================================
   按钮
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--gray-700);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--border-hover);
    background: var(--gray-50);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

/* ============================================================
   顶部导航
   ============================================================ */

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title {
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
}

.topbar-center {
    flex: 1;
    display: flex;
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    flex: 1;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.user-name {
    font-weight: 500;
}

.role-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.role-badge.admin {
    background: var(--warning-light);
    color: var(--warning);
}

.role-badge.user {
    background: var(--primary-light);
    color: var(--primary);
}

/* ============================================================
   管理员工具栏
   ============================================================ */

.admin-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px 20px;
    background: var(--gray-100);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

/* 显示列工具栏（所有用户可见） */
.view-toolbar {
    display: flex;
    gap: 12px;
    padding: 6px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.view-toolbar-hint {
    font-size: 12px;
    color: var(--gray-500);
}

/* 显示列设置对话框里的复选框网格 */
.column-visibility-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
    padding: 12px 0;
}
.column-visibility-grid .column-visibility-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.column-visibility-grid .column-visibility-item:hover {
    background: var(--gray-50);
}
.column-visibility-grid input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}
.column-visibility-grid .column-visibility-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.column-visibility-grid .column-width-input {
    width: 60px;
    padding: 2px 4px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
    flex-shrink: 0;
}
.column-visibility-grid .column-width-unit {
    font-size: 11px;
    color: var(--gray-500);
    flex-shrink: 0;
}

/* ============================================================
   主内容
   ============================================================ */

.main-content {
    padding: 16px 20px;
    padding-bottom: 60px;        /* 给底部状态栏留空间，分页栏不会被遮住 */
    max-width: 100%;
    margin: 0 auto;
}

.table-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--gray-600);
}

.table-wrapper {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: auto;                 /* 同时支持水平和垂直滚动 */
    overflow-y: scroll;             /* 强制显示垂直滚动条，让水平滚动条位置固定在最底部，不挡 th */
    max-height: calc(100vh - 230px);  /* 留出 topbar(56) + admin-toolbar(40) + view-toolbar(40) + table-info(40) + statusbar(28) + 余量 */
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: var(--gray-100);
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 500;
    color: var(--gray-700);
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
    cursor: pointer;
}

.loading-cell {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

/* 表格操作按钮 - 紧凑布局适合"操作"列 */
.table-action-btn {
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    margin-right: 2px;
}
.table-action-btn:last-child {
    margin-right: 0;
}

.table-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.table-action-btn.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ============================================================
   分页
   ============================================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;             /* 页数很多时换行，避免撑爆容器 */
    padding: 4px 0;
}

.page-btn {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}

.page-btn:hover {
    border-color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================
   底部状态栏
   ============================================================ */

.statusbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: var(--gray-100);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 12px;
    color: var(--gray-500);
}

/* ============================================================
   弹窗
   ============================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 500;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    color: var(--gray-800);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ============================================================
   移动端适配：详情页（客户详情对话框）
   - 用 .mobile-device class 控制（不用 @media，因为微信浏览器不遵守 viewport meta）
   - 详情页在浏览器范围内（留 8px 边距）+ 圆角
   - 关闭按钮放页面正中间顶端（不与标题重叠）
   ============================================================ */

.mobile-device #detail-modal .modal-overlay {
    padding: 0;                       /* 取消 padding，让 modal 真正贴边 */
    align-items: stretch;
}
.mobile-device #detail-modal .modal {
    width: 100vw;                     /* 用 vw 强制等于视口宽度，绕开微信浏览器 980px viewport 陷阱 */
    max-width: 100vw;
    min-width: 0;
    height: 100vh;                    /* 满屏（不预留边距） */
    max-height: 100vh;
    border-radius: 0;                 /* 圆角改为顶部圆角过渡 */
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-sizing: border-box;
    margin: 0;
    overflow: hidden;
    left: 0;
    right: 0;
    top: 0;
    transform: none;
}
/* modal-header 改成垂直布局：关闭按钮单独一行顶部中央，标题在下面 */
.mobile-device #detail-modal .modal-header {
    position: relative;
    display: block;                  /* 不再用 flex */
    padding: 8px 12px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    width: 100%;
    box-sizing: border-box;
}
.mobile-device #detail-modal .modal-close {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 26px;
    line-height: 1;
    padding: 0 12px;
    color: var(--gray-600);
    z-index: 1;
}
.mobile-device #detail-modal .modal-header h2 {
    font-size: 14px;
    font-weight: 500;
    margin: 24px 0 0;               /* 给上方关闭按钮留 24px 空间 */
    text-align: center;
    width: 100%;
    white-space: normal;
    word-break: break-all;
    overflow-wrap: anywhere;
    padding: 0 4px;
    box-sizing: border-box;
}
.mobile-device #detail-modal .modal-body {
    padding: 12px;
    font-size: 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* 移动端：管理员工具栏按钮也换行展示 */
.mobile-device .admin-toolbar,
.mobile-device .view-toolbar {
    flex-wrap: wrap;
    gap: 6px;
}
.mobile-device .admin-toolbar .btn,
.mobile-device .view-toolbar .btn {
    font-size: 12px;
    padding: 4px 10px;
}

/* 移动端：body 禁止横向滚动，防止任何元素溢出导致页面变宽 */
.mobile-device body {
    overflow-x: hidden !important;
    width: 100vw !important;
    max-width: 100vw !important;
    position: relative;
}

/* ============================================================
   移动端详情页 modal - 强力覆盖
   关键问题：默认 modal-overlay 有 padding:20px + display:flex 居中
   这导致 modal 在 mobile 下被推到屏幕中间 + 缩进 20px 边距
   ============================================================ */

/* 覆盖 #detail-modal 容器 */
.mobile-device #detail-modal,
.mobile-device #detail-modal.modal,
.mobile-device #detail-modal.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    transform: none !important;
    background: #fff;
    z-index: 9999;
}

/* 覆盖 modal-overlay 的 flex 居中 */
.mobile-device #detail-modal .modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    display: block !important;
    align-items: stretch !important;
    justify-content: stretch !important;
}

/* modal 内容铺满 */
.mobile-device #detail-modal .modal {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    transform: none !important;
    border-radius: 0 !important;
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
    box-sizing: border-box !important;
    overflow: hidden;
}

/* modal-header 改成垂直布局：关闭按钮单独一行顶部中央，标题在下面 */
.mobile-device #detail-modal .modal-header {
    position: relative;
    display: block;
    padding: 8px 12px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    width: 100%;
    box-sizing: border-box;
}
.mobile-device #detail-modal .modal-close {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 26px;
    line-height: 1;
    padding: 0 12px;
    color: var(--gray-600);
    z-index: 1;
}
.mobile-device #detail-modal .modal-header h2 {
    font-size: 14px;
    font-weight: 500;
    margin: 24px 0 0;
    text-align: center;
    width: 100%;
    white-space: normal;
    word-break: break-all;
    overflow-wrap: anywhere;
    padding: 0 4px;
    box-sizing: border-box;
}
.mobile-device #detail-modal .modal-body {
    padding: 12px 14px;
    font-size: 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    word-break: break-word;
    overflow-wrap: anywhere;
    flex: 1;
}
.mobile-device #detail-modal .detail-grid {
    grid-template-columns: 1fr !important;
    gap: 6px;
    max-width: 100%;
    width: 100%;
}
.mobile-device #detail-modal .detail-grid > div,
.mobile-device #detail-modal .detail-grid .detail-value {
    word-break: break-all;
    overflow-wrap: anywhere;
    max-width: 100%;
    min-width: 0;
}
.mobile-device #detail-modal .detail-section {
    padding: 8px 10px;
    font-size: 13px;
    max-width: 100%;
    overflow: hidden;
}
/* 备注列表 / 表单也强制不溢出 */
.mobile-device #detail-modal .remark-item,
.mobile-device #detail-modal .remark-form,
.mobile-device #detail-modal .detail-form {
    max-width: 100%;
    word-break: break-all;
    overflow-wrap: anywhere;
}
.mobile-device #detail-modal .detail-form input,
.mobile-device #detail-modal .detail-form textarea {
    max-width: 100%;
    box-sizing: border-box;
    width: 100%;
}

/* ============================================================
   移动端表格重置 - 让 4 列模式真正自适应、不被冻结/sticky/列宽干扰
   ============================================================ */

/* 清除所有 sticky（垂直 + 水平），移动端不再冻结 */
.mobile-device .data-table-wide thead th,
.mobile-device .data-table-wide tbody td,
.mobile-device .data-table-wide thead th:nth-child(1),
.mobile-device .data-table-wide thead th:nth-child(2),
.mobile-device .data-table-wide tbody td:nth-child(1),
.mobile-device .data-table-wide tbody td:nth-child(2) {
    position: static !important;
    left: auto !important;
    top: auto !important;
    box-shadow: none !important;
    border-right: 1px solid var(--border) !important;
}

/* 表头不黏顶（保持简单） */
.mobile-device .data-table-wide thead th {
    background: var(--gray-100);
}

/* 表格行紧凑 */
.mobile-device .data-table-wide {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
.mobile-device .data-table-wide th,
.mobile-device .data-table-wide td {
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    padding: 6px 6px;
    font-size: 12px;
    line-height: 1.4;
    vertical-align: middle;
}
.mobile-device .data-table-wide th {
    font-size: 11px;
    padding: 6px 4px;
    white-space: nowrap;
}

/* 容器允许横向滚动 */
.mobile-device .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100vh - 240px);
}

/* 移动端表格列宽：4 列紧凑布局（23锁号/公司/联系方式/操作） */
.mobile-device .data-table-wide th:nth-child(2),  /* lock_2023 */
.mobile-device .data-table-wide td:nth-child(2) { width: 80px; min-width: 80px; }

.mobile-device .data-table-wide th:nth-child(8),  /* company */
.mobile-device .data-table-wide td:nth-child(8) { width: 100px; min-width: 100px; }

.mobile-device .data-table-wide th:nth-child(11), /* contact_info */
.mobile-device .data-table-wide td:nth-child(11) { width: 95px; min-width: 95px; }

.mobile-device .data-table-wide th:nth-child(16), /* actions */
.mobile-device .data-table-wide td:nth-child(16) { width: 130px; min-width: 130px; }

/* 操作按钮压缩 */
.mobile-device .data-table-wide td:nth-child(16) .table-action-btn {
    padding: 2px 6px;
    font-size: 11px;
    margin-right: 2px;
}

/* ============================================================
   移动端详情页 modal 自适应
   关键：内容不超出浏览器边界
   ============================================================ */
.mobile-device #detail-modal .modal-body {
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    word-break: break-word;
    overflow-wrap: anywhere;
    padding: 12px 14px;
    max-width: 100%;
}
.mobile-device #detail-modal .detail-grid {
    grid-template-columns: 1fr;
    gap: 6px;
    max-width: 100%;
    width: 100%;
}
.mobile-device #detail-modal .detail-grid > div {
    word-break: break-all;
    overflow-wrap: anywhere;
    max-width: 100%;
    min-width: 0;
}
.mobile-device #detail-modal .detail-grid .detail-value {
    max-width: 100%;
    overflow-wrap: anywhere;
}
.mobile-device #detail-modal .detail-section {
    padding: 8px 10px;
    font-size: 13px;
    max-width: 100%;
    overflow: hidden;
}
.mobile-device #detail-modal {
    max-width: 100%;
}
.mobile-device #detail-modal .modal {
    max-width: 100%;
}
/* 备注列表 / 编辑区不溢出 */
.mobile-device #detail-modal .remark-item,
.mobile-device #detail-modal .remark-form {
    max-width: 100%;
    word-break: break-all;
    overflow-wrap: anywhere;
}
/* 表单 input 也强制 100% */
.mobile-device #detail-modal .detail-form input,
.mobile-device #detail-modal .detail-form textarea {
    max-width: 100%;
    box-sizing: border-box;
}

.modal-tip {
    color: var(--gray-500);
    font-size: 13px;
    margin-bottom: 16px;
}

/* ============================================================
   表单
   ============================================================ */

.edit-form .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.form-group textarea {
    resize: vertical;
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ============================================================
   详情页
   ============================================================ */

.detail-section {
    margin-bottom: 24px;
}

.detail-section h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-item label {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 2px;
}

.detail-item span {
    font-size: 14px;
    color: var(--gray-800);
}

.remark-list {
    max-height: 300px;
    overflow-y: auto;
}

.remark-item {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 8px;
}

.remark-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.remark-content {
    font-size: 14px;
    color: var(--gray-800);
}

.remark-empty {
    color: var(--gray-400);
    text-align: center;
    padding: 20px;
    font-size: 13px;
}

/* ============================================================
   报价信息 - 详情页报价列表 / 表格报价信息列 / 报价弹窗
   ============================================================ */

/* 表格中"报价信息"列 */
.quote-info-cell {
    font-size: 12px;
    color: var(--gray-700);
    max-width: 180px;
    white-space: normal;
    word-break: break-all;
    line-height: 1.5;
}

/* 详情页报价列表 */
.quote-list {
    max-height: 320px;
    overflow-y: auto;
}

.quote-item {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 8px;
    border-left: 3px solid var(--color-primary, #1565C0);
}

.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.quote-delete-btn {
    margin-left: 8px;
    padding: 1px 8px;
    font-size: 11px;
}

.quote-index {
    font-weight: 600;
    color: var(--color-primary, #1565C0);
}

.quote-user {
    font-weight: 500;
    color: var(--gray-700);
}

.quote-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px 12px;
    font-size: 13px;
}

.quote-row {
    display: flex;
    gap: 4px;
    min-width: 0;   /* 允许在 grid cell 内被压缩，长文本能正常截断 */
}

.quote-row label {
    color: var(--gray-500);
    white-space: nowrap;
    flex-shrink: 0;
}

.quote-row span {
    color: var(--gray-800);
    word-break: break-all;
    overflow-wrap: anywhere;
}

/* 报价弹窗 - 电脑/手机双端自适应 */
#quote-modal .modal {
    max-width: 460px;
    width: 100%;
}

#quote-modal textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
}

.mobile-device #quote-modal .modal {
    max-width: 100vw;
    width: 100vw;
    height: auto;
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
    margin: 0;
}

.mobile-device #quote-modal .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px;
}

.remark-form {
    margin-top: 16px;
}

.remark-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.remark-counter {
    text-align: right;
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

.detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ============================================================
   文件上传
   ============================================================ */

.file-input {
    display: block;
    width: 100%;
    padding: 10px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.import-result {
    background: var(--success-light);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 13px;
}

.import-result .error-list {
    margin-top: 8px;
    max-height: 150px;
    overflow-y: auto;
    color: var(--danger);
    font-size: 12px;
}

/* ============================================================
   Toast
   ============================================================ */

.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius);
    background: var(--gray-800);
    color: #fff;
    font-size: 14px;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* ============================================================
   表格操作区
   ============================================================ */

.table-actions {
    margin-bottom: 12px;
}

/* 用户管理表格：4 个操作按钮紧凑排布 */
#user-table td:last-child {
    white-space: nowrap;
}
#user-table .table-action-btn {
    padding: 2px 7px;
    font-size: 11px;
    margin-right: 3px;
}

.user-status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.user-status.active {
    background: var(--success-light);
    color: var(--success);
}

.user-status.disabled {
    background: var(--danger-light);
    color: var(--danger);
}

/* ============================================================
   响应式 - 手机端
   ============================================================ */

@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 12px;
        gap: 8px;
    }

    .topbar-title {
        font-size: 15px;
    }

    .topbar-center {
        order: 3;
        width: 100%;
        max-width: none;
    }

    .search-input {
        font-size: 16px; /* 防止iOS自动缩放 */
    }

    .topbar-right {
        margin-left: auto;
    }

    .admin-toolbar {
        padding: 8px 12px;
    }

    .main-content {
        padding: 10px 12px;
        padding-bottom: 40px;
    }

    /* 表格在窄屏自适应（不再硬编码隐藏某些列 — 由 JS 的 applyColumnVisibility 按用户偏好控制） */
    .data-table-wide {
        table-layout: auto;
    }

    /* 手机端可见列不冻结 */
    .data-table-wide th:first-child,
    .data-table-wide td:first-child {
        position: static;
        box-shadow: none;
    }

    .data-table-wide th,
    .data-table-wide td {
        white-space: normal;
        word-wrap: break-word;
        padding: 8px 10px;
        font-size: 13px;
    }

    /* 操作列不换行 */
    .data-table-wide th:nth-child(16),
    .data-table-wide td:nth-child(16) {
        white-space: nowrap;
        width: auto;
    }

    .modal {
        max-width: 100%;
        max-height: 95vh;
    }

    .edit-form .form-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .statusbar {
        font-size: 11px;
        padding: 0 12px;
    }
}

/* ============================================================
   宽表格样式 - 全部列折行显示
   ============================================================ */

.data-table-wide {
    table-layout: fixed;
    width: 100%;
}

.data-table-wide th {
    white-space: nowrap;     /* 标题不换行：保证"列名+🔍"同行排列 */
}
.data-table-wide td {
    white-space: normal;     /* 数据允许换行（长地址、长公司名等） */
    word-wrap: break-word;
    word-break: break-all;
    padding: 6px 10px;
    font-size: 13px;
    vertical-align: top;
    line-height: 1.5;
}

/* 各列宽度设定 - 适配1920x1080 */
.data-table-wide th:nth-child(1),  /* 2018版锁号 */
.data-table-wide td:nth-child(1) { width: 105px; }

.data-table-wide th:nth-child(2),  /* 2023版锁号 */
.data-table-wide td:nth-child(2) { width: 105px; }

.data-table-wide th:nth-child(3),  /* 帐号 */
.data-table-wide td:nth-child(3) { width: 100px; }       /* 帐号列可能含长备注，正常折行 */

.data-table-wide th:nth-child(4),  /* 限时时间 */
.data-table-wide td:nth-child(4) { width: 95px; }

.data-table-wide th:nth-child(5),  /* 外壳编号等信息 */
.data-table-wide td:nth-child(5) { width: 130px; }

.data-table-wide th:nth-child(6),  /* 日期 */
.data-table-wide td:nth-child(6) { width: 75px; }

.data-table-wide th:nth-child(7),  /* 经办人 */
.data-table-wide td:nth-child(7) { width: 90px; }

.data-table-wide th:nth-child(8),  /* 公司名称 */
.data-table-wide td:nth-child(8) { width: 150px; }

.data-table-wide th:nth-child(9),  /* 软件/专业（合并） */
.data-table-wide td:nth-child(9) { width: 160px; }

.data-table-wide th:nth-child(10), /* 地址 */
.data-table-wide td:nth-child(10) { width: 160px; }

.data-table-wide th:nth-child(11), /* 联系方式（合并） */
.data-table-wide td:nth-child(11) { width: 150px; }

.data-table-wide th:nth-child(12), /* 地级市 */
.data-table-wide td:nth-child(12) { width: 75px; }

.data-table-wide th:nth-child(13), /* 县份 */
.data-table-wide td:nth-child(13) { width: 65px; }

.data-table-wide th:nth-child(14), /* 备注数 */
.data-table-wide td:nth-child(14) { width: 70px; text-align: center; }

.data-table-wide th:nth-child(15), /* 报价信息 */
.data-table-wide td:nth-child(15) { width: 180px; }

.data-table-wide th:nth-child(16), /* 操作 */
.data-table-wide td:nth-child(16) { width: 230px; white-space: nowrap; }

/* 长文本列 - 折行显示 */
.cell-long {
    white-space: normal;
    word-wrap: break-word;
    word-break: break-all;
}

/* 合并列（软件/专业、联系方式）：次行小字；颜色与主行一致（不区分） */
.merged-cell {
    line-height: 1.4;
}
.cell-sub {
    font-size: 11px;
    color: inherit;
}

/* 近期到期按钮 */
.btn-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.btn-warning:hover {
    background: var(--warning);
    color: #fff;
}

/* 限时时间到期高亮 */
.expiring-row {
    background: #FFF9E6 !important;
}

.expiring-time {
    color: var(--danger);
    font-weight: 600;
}

/* 表头粘性 - 移除 thead 自身的 sticky，由每个 th 独立做 sticky（避免嵌套 sticky 上下文冲突） */
.data-table-wide thead {
    /* 不再 position: sticky，由 th 直接控制 */
}

/* 所有 th 都垂直 sticky：表格垂直滚动时整行表头黏在容器顶部 */
.data-table-wide thead th {
    position: sticky;
    top: 0;
    z-index: 4;                       /* 默认 z-index；冻结列单独提高 */
    background: var(--gray-100);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);   /* 轻阴影 */
}

/* ============================================================
   冻结列 - 2018版锁号(列1) 和 2023版锁号(列2)
   水平滚动时这两列固定在视口最左侧
   ============================================================ */

.data-table-wide {
    border-collapse: separate;   /* 改用 separate 让 border-right 真正显示 */
    border-spacing: 0;
}

/* 冻结列 1: 2018版锁号 - th 水平 sticky + td 水平 sticky */
.data-table-wide th:nth-child(1) {
    left: 0;                          /* 水平 sticky：黏在视口最左 */
    z-index: 6;                       /* 高于其他 th(4) */
    border-right: 1px solid #c0c4cc;  /* 较细的分隔线 */
}
.data-table-wide td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 5;                       /* 高于 tbody(0) */
    background: #fff;
    border-right: 1px solid #c0c4cc;
}

/* 冻结列 2: 2023版锁号 */
.data-table-wide th:nth-child(2) {
    left: 105px;                      /* = 列1宽度 105px，黏在列1右边 */
    z-index: 6;
    border-right: 1px solid #c0c4cc;
}
.data-table-wide td:nth-child(2) {
    position: sticky;
    left: 105px;
    z-index: 5;
    background: #fff;
    border-right: 1px solid #c0c4cc;
}

/* tbody 内冻结列 hover 效果 */
.data-table-wide tbody tr:hover td:nth-child(1),
.data-table-wide tbody tr:hover td:nth-child(2) {
    background: var(--gray-50);
}
/* 到期行淡黄：让冻结列跟着 tr.expiring-7d 一起变淡黄 */
.data-table-wide tbody tr.expiring-7d td:nth-child(1),
.data-table-wide tbody tr.expiring-7d td:nth-child(2) {
    background: #FFF6E5;
}
.data-table-wide tbody tr.expiring-7d:hover td:nth-child(1),
.data-table-wide tbody tr.expiring-7d:hover td:nth-child(2) {
    background: #FFEED2;
}

/* 导入模式选择 */
.import-mode-group {
    margin: 16px 0;
}

.import-mode-group label {
    display: block;
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
    margin-bottom: 8px;
}

.import-mode-options {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
}

.import-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    cursor: pointer;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s;
    flex: 1;
}

.import-mode-option:hover {
    border-color: var(--primary);
}

.import-mode-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.import-mode-option input {
    margin-top: 2px;
}

.import-mode-option-text {
    font-size: 13px;
}

.import-mode-option-text strong {
    display: block;
    font-size: 14px;
    color: var(--gray-800);
}

.import-mode-option-text small {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* 二次确认对话框 */
.confirm-dialog {
    text-align: center;
}

.confirm-dialog .confirm-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.confirm-dialog .confirm-message {
    font-size: 15px;
    color: var(--gray-800);
    margin-bottom: 8px;
    line-height: 1.6;
}

.confirm-dialog .confirm-warning {
    font-size: 13px;
    color: var(--danger);
    margin-bottom: 16px;
}

/* ============================================================
   表头筛选（Excel风格）
   ============================================================ */

.data-table th {
    position: relative;
}

.th-text {
    display: inline;
}

.th-filter {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 1px 3px;
    border-radius: 3px;
    vertical-align: middle;
    user-select: none;
}

.th-filter:hover {
    color: var(--primary);
    background: var(--primary-light);
}

th.filter-active .th-filter {
    color: var(--primary);
    font-weight: 600;
}

th.filter-active {
    color: var(--primary);
}

/* 筛选下拉框 */
.filter-dropdown {
    position: fixed;
    width: 260px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    overflow: hidden;
}

.filter-search-box {
    padding: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.filter-search-box input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
}

.filter-search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-actions-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 12px;
    font-size: 12px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.filter-actions-row a {
    color: var(--primary);
    text-decoration: none;
}

.filter-actions-row a:hover {
    text-decoration: underline;
}

.filter-options {
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 0;
}

/* 快捷筛选（固定选项）的说明行 */
.filter-hint-line {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-option:hover {
    background: var(--gray-50);
}

.filter-option input {
    flex-shrink: 0;
    cursor: pointer;
}

.filter-option span {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px;
}

.filter-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* 筛选状态提示 */
.clear-filter-link {
    color: var(--primary);
    margin-left: 4px;
}

.clear-filter-link:hover {
    text-decoration: underline;
}

/* ============================================================
   7日内到期高亮（淡橙色，不刺眼）
   ============================================================ */

.expiring-7d {
    background: #FFF6E5 !important;
}

.data-table-wide tbody tr.expiring-7d td:first-child {
    background: #FFF6E5;
}

.data-table-wide tbody tr.expiring-7d:hover td,
.data-table-wide tbody tr.expiring-7d:hover td:first-child {
    background: #FFEED2;
}

.expiring-time {
    color: #B45309;
    font-weight: 600;
}

.legend-7d {
    color: #B45309;
    background: #FFF6E5;
    padding: 0 3px;
    border-radius: 3px;
}

/* ============================================================
   备份路径选择（文件夹浏览）
   ============================================================ */

.path-input-group {
    display: flex;
    gap: 8px;
}

.path-input-group input {
    flex: 1;
}

.path-browse-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

.dir-browser-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.dir-current {
    flex: 1;
    font-size: 13px;
    color: var(--gray-600);
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 10px;
    word-break: break-all;
}

.dir-list {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.dir-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-50);
}

.dir-item:hover {
    background: var(--primary-light);
}

.dir-item-up {
    color: var(--gray-500);
}

.dir-icon {
    flex-shrink: 0;
}

/* ============================================================
   手机端适配
   ============================================================ */

@media (max-width: 768px) {
    .filter-dropdown {
        position: fixed;
        left: 8px !important;
        right: 8px;
        width: auto;
        top: 15% !important;
    }

    .filter-option span {
        max-width: none;
    }

    .table-info {
        flex-wrap: wrap;
        gap: 4px;
    }

    .path-input-group {
        flex-direction: column;
    }
}

/* ============================================================
   登录页改造：访客查询 + 右上角登录入口
   ============================================================ */

/* 右上角登录按钮（默认登录页常驻） */
.top-login-btn {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 100;
    padding: 8px 22px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius);
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}
.top-login-btn:hover {
    background: #fff;
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* 访客查询主区域（默认页中央） */
.visitor-stage {
    width: 100%;
    max-width: 460px;
    padding: 40px 28px;
    color: #fff;
    text-align: center;
}

.visitor-logo .logo-icon {
    color: #fff;
    font-size: 56px;
}

.visitor-logo h1 {
    color: #fff;
    font-size: 26px;
    font-weight: 500;
    margin: 12px 0 6px;
}

.visitor-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    margin-bottom: 28px;
}

.visitor-form {
    background: rgba(255, 255, 255, 0.96);
    padding: 28px 28px 22px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: left;
}

.visitor-form .form-group {
    margin-bottom: 18px;
}

.visitor-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.visitor-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.visitor-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.visitor-form .btn-primary {
    font-size: 15px;
    padding: 11px 16px;
}

.visitor-result {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    border: 1px solid transparent;
}
.visitor-result.success {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}
.visitor-result.fail {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.visitor-tip {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    margin-top: 20px;
    line-height: 1.6;
}
.visitor-tip a {
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
}
.visitor-tip a:hover {
    color: var(--primary-light);
}

/* 登录弹窗 */
.login-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s;
}

.login-card-modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 20px;
    animation: slideUp 0.25s;
}

.modal-close-x {
    position: absolute;
    top: 12px;
    right: 16px;
    background: transparent;
    border: 0;
    font-size: 28px;
    line-height: 1;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: all 0.2s;
}
.modal-close-x:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

/* 记住我复选框 */
.form-remember {
    margin: -4px 0 18px;
}
.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
    user-select: none;
}
.remember-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}
.remember-label span {
    line-height: 1.4;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 540px) {
    .top-login-btn {
        top: 12px;
        right: 14px;
        padding: 6px 16px;
        font-size: 13px;
    }
    .visitor-stage {
        padding: 20px 16px;
    }
    .visitor-logo h1 {
        font-size: 22px;
    }
}
