/* ===================================================================
   工作留痕记录 - 移动优先样式表
   断点：<=767px 手机 / >=768px 平板桌面
   =================================================================== */

:root {
    --brand: #2563eb;
    --brand-d: #1d4ed8;
    --brand-l: #eff5ff;
    --bg: #f4f6fa;
    --card: #ffffff;
    --text: #1f2937;
    --text-2: #4b5563;
    --muted: #8a94a6;
    --line: #e6e9ef;
    --danger: #dc2626;
    --danger-l: #fef2f2;
    --ok: #059669;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
    --shadow-lg: 0 10px 30px rgba(16, 24, 40, .16);
    --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
img, video { max-width: 100%; }

/* ---------------- 顶栏 ---------------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in {
    max-width: 1100px; margin: 0 auto;
    height: 54px; padding: 0 14px;
    display: flex; align-items: center; gap: 10px;
}
.brand {
    display: flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: 16px; color: var(--text); letter-spacing: .2px;
    white-space: nowrap;
}
.brand-logo {
    width: 28px; height: 28px; border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 15px; flex: 0 0 auto;
}
.brand small { font-weight: 400; font-size: 11px; color: var(--muted); letter-spacing: .5px; }
.topbar-spacer { flex: 1 1 auto; }
.topbar-user {
    font-size: 13px; color: var(--muted); max-width: 96px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar a.tb-link {
    font-size: 13px; color: var(--text-2); padding: 8px 6px; border-radius: 8px;
}
.topbar a.tb-link:active { background: var(--brand-l); }

/* ---------------- 容器 ---------------- */
.container {
    max-width: 1100px; margin: 0 auto;
    padding: 14px 14px calc(96px + var(--safe-b));
}
@media (min-width: 768px) {
    .container { padding: 24px 24px 64px; }
    .topbar-in { padding: 0 24px; }
}

/* ---------------- 标题区 ---------------- */
.page-head { margin-bottom: 14px; }
.page-title { margin: 0 0 2px; font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.page-sub { font-size: 13px; color: var(--muted); }

/* ---------------- 工具栏 ---------------- */
.toolbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 12px;
}
.toolbar .grow { flex: 1 1 auto; }

/* ---------------- 筛选 ---------------- */
.filter-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line); background: #fff; color: var(--text-2);
    padding: 0 14px; height: 42px; border-radius: 10px;
    font-size: 14px; cursor: pointer; font-family: inherit;
}
.filter-toggle:active { background: var(--brand-l); }
.filter-toggle .caret { font-size: 10px; transition: transform .18s; }
.filter-toggle.open .caret { transform: rotate(180deg); }

.filter-panel {
    display: none;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px; margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.filter-panel.show { display: block; }
.filter-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 768px) { .filter-grid { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; } }

/* ---------------- 表单控件 ---------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .lbl {
    font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.field .req { color: var(--danger); font-weight: 400; }
.field .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }

input[type=text], input[type=password], input[type=search],
input[type=datetime-local], input[type=date], input[type=file], select, textarea {
    width: 100%;
    font-family: inherit;
    font-size: 16px;                 /* 关键：>=16px 防 iOS 聚焦自动放大 */
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
input[type=file] { padding: 9px 10px; font-size: 14px; background: #fbfcfe; }
select {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a94a6' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 32px;
}
@media (min-width: 768px) {
    input[type=text], input[type=password], input[type=search],
    input[type=datetime-local], input[type=date], select, textarea { font-size: 14px; }
}

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 42px; padding: 0 16px;
    border-radius: 10px; border: 1px solid var(--line);
    background: #fff; color: var(--text-2);
    font-size: 14px; font-weight: 600; font-family: inherit;
    cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, transform .06s;
    -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(.985); }
.btn-primary {
    background: var(--brand); border-color: var(--brand); color: #fff;
    box-shadow: 0 1px 2px rgba(37, 99, 235, .28);
}
.btn-primary:active { background: var(--brand-d); }
.btn-danger { color: var(--danger); border-color: #f6c9c9; background: #fff; }
.btn-danger:active { background: var(--danger-l); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 34px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn .ico { font-size: 15px; line-height: 1; }

/* 移动端底部主按钮 / 桌面右上 */
.btn-add-desktop { display: none; }
@media (min-width: 768px) { .btn-add-desktop { display: inline-flex; } }

/* ---------------- 记录卡片 ---------------- */
.rec-list { display: flex; flex-direction: column; gap: 10px; }

.rec-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 13px 14px;
    position: relative;
    transition: border-color .15s, box-shadow .15s;
}
.rec-card:active { border-color: #cfd8e8; }
.rec-top { display: flex; align-items: flex-start; gap: 10px; }
.rec-time {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12.5px; color: var(--brand);
    background: var(--brand-l);
    border-radius: 7px; padding: 3px 8px;
    font-variant-numeric: tabular-nums; font-weight: 600;
}
.rec-title {
    font-size: 15.5px; font-weight: 700; color: var(--text);
    margin: 0; line-height: 1.45; word-break: break-word;
}
.rec-title.untitled { color: var(--text-2); font-weight: 600; }
.rec-body {
    margin: 8px 0 0;
    font-size: 14px; color: var(--text-2);
    line-height: 1.68; white-space: pre-wrap; word-break: break-word;
}
.rec-body.clamp {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}
.rec-meta {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--text-2);
    background: #f3f5f9; border-radius: 7px; padding: 3.5px 8px;
    max-width: 100%;
}
.chip .cl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.share-on { background: #ecfdf5; color: #047857; }

/* 附件缩略图行 */
.thumb-row { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.thumb {
    width: 52px; height: 52px; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--line); background: #f7f8fb;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; color: var(--muted); flex: 0 0 auto;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.more { font-size: 12px; font-weight: 700; color: var(--text-2); background: #eef1f6; }

/* 操作区 */
.rec-actions {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line);
}
.rec-actions .btn { flex: 1 1 0; min-width: 0; height: 40px; padding: 0 8px; font-size: 13px; }
@media (min-width: 768px) {
    .rec-actions { justify-content: flex-end; border-top: 1px dashed var(--line); }
    .rec-actions .btn { flex: 0 0 auto; min-width: 74px; height: 34px; }
}

/* ---------------- 标题可点击进详情（与点缩略图同效） ---------------- */
.rec-title .rt-link {
    display: flex;
    align-items: baseline;
    gap: 5px;
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.rec-title .rt-text {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}
.rec-title .rt-arrow {
    flex: 0 0 auto;
    font-style: normal;
    font-size: 18px;
    line-height: 1;
    color: #c3cbd9;
    transition: color .15s, transform .15s;
}
.rec-title .rt-link:hover .rt-text,
.rec-title .rt-link:active .rt-text { color: var(--brand); }
.rec-title .rt-link:hover .rt-arrow,
.rec-title .rt-link:active .rt-arrow {
    color: var(--brand);
    transform: translateX(2px);
}

/* ---------------- 空状态 ---------------- */
.empty {
    text-align: center; padding: 52px 20px;
    background: var(--card); border: 1px dashed #d8dee9; border-radius: var(--radius);
    color: var(--muted);
}
.empty .em-ico { font-size: 40px; opacity: .55; }
.empty .em-t { margin-top: 10px; font-size: 15px; color: var(--text-2); font-weight: 600; }
.empty .em-s { margin-top: 4px; font-size: 13px; }

/* ---------------- 分页 ---------------- */
.pager {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 16px; flex-wrap: wrap;
}
.pager .pg {
    min-width: 38px; height: 38px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); background: #fff; color: var(--text-2);
    border-radius: 9px; font-size: 13.5px; font-variant-numeric: tabular-nums;
}
.pager .pg.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.pager .pg.dis { opacity: .4; pointer-events: none; }
.pager .pg-info { font-size: 12.5px; color: var(--muted); }

/* ---------------- 悬浮新增按钮（手机） ---------------- */
.fab {
    position: fixed; right: 18px;
    bottom: calc(18px + var(--safe-b));
    z-index: 40;
    width: 56px; height: 56px; border-radius: 50%;
    border: none; background: var(--brand); color: #fff;
    font-size: 27px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 18px rgba(37, 99, 235, .38);
    cursor: pointer;
}
.fab:active { background: var(--brand-d); transform: scale(.96); }
@media (min-width: 768px) { .fab { display: none; } }

/* ---------------- 模态框 ---------------- */
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: none;
    background: rgba(17, 24, 39, .45);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal.show { display: flex; align-items: flex-end; justify-content: center; }
.modal-card {
    background: #fff;
    width: 100%;
    max-height: 100vh;
    height: 100%;
    display: flex; flex-direction: column;
    border-radius: 0;
    box-shadow: var(--shadow-lg);
    animation: slideUp .22s ease-out;
}
@keyframes slideUp { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }

.modal-head {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px calc(12px) 14px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-head .mh-spacer { flex: 1 1 auto; }
.icon-btn {
    width: 36px; height: 36px; border-radius: 9px; border: none;
    background: #f3f5f9; color: var(--text-2); font-size: 17px; line-height: 1;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:active { background: #e6eaf2; }

.modal-body {
    flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 14px; display: flex; flex-direction: column; gap: 13px;
}
.modal-foot {
    flex: 0 0 auto;
    display: flex; gap: 8px;
    padding: 11px 14px calc(11px + var(--safe-b));
    border-top: 1px solid var(--line);
    background: #fff;
}
.modal-foot .btn { flex: 1 1 0; }

@media (min-width: 768px) {
    .modal.show { align-items: center; padding: 24px; }
    .modal-card {
        width: 100%; max-width: 660px;
        height: auto; max-height: calc(100vh - 48px);
        border-radius: 16px;
    }
    .modal-head { padding-top: 14px; }
    .modal-foot { justify-content: flex-end; }
    .modal-foot .btn { flex: 0 0 auto; min-width: 96px; }
}

/* 弹窗内字段两列（桌面） */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 13px; }
@media (min-width: 768px) {
    .form-grid.two { grid-template-columns: 1fr 1fr; }
    .form-grid.three { grid-template-columns: repeat(3, 1fr); }
}

/* 已上传附件（编辑态） */
.exist-files { display: flex; flex-direction: column; gap: 6px; }
.exist-file {
    display: flex; align-items: center; gap: 8px;
    background: #f7f9fc; border: 1px solid var(--line);
    border-radius: 9px; padding: 7px 9px; font-size: 13px;
}
.exist-file .ef-ico { font-size: 15px; flex: 0 0 auto; }
.exist-file .ef-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exist-file .ef-size { color: var(--muted); font-size: 11.5px; flex: 0 0 auto; }
.exist-file .ef-del {
    border: none; background: transparent; color: var(--danger);
    font-size: 15px; cursor: pointer; padding: 2px 4px; flex: 0 0 auto;
}
.exist-file.removing { opacity: .45; text-decoration: line-through; }

/* 新选择文件列表 */
.pick-list { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; }
.pick-item {
    display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2);
    background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px;
}
.pick-item .pi-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-item .pi-size { color: var(--muted); flex: 0 0 auto; }
.pick-item .pi-del {
    flex: 0 0 auto;
    border: none; background: transparent;
    color: var(--danger); font-size: 14px; line-height: 1;
    padding: 2px 4px; cursor: pointer; border-radius: 5px;
}
.pick-item .pi-del:active { background: var(--danger-l); }
.pick-tip { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 22px 16px calc(22px + var(--safe-b));
    background:
        radial-gradient(1000px 520px at 12% -10%, #e2ecff 0%, rgba(226, 236, 255, 0) 62%),
        radial-gradient(800px 460px at 96% 8%, #e6fbf4 0%, rgba(230, 251, 244, 0) 58%),
        var(--bg);
}
.login-card {
    width: 100%; max-width: 380px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 18px; box-shadow: var(--shadow-lg);
    padding: 26px 20px 22px;
}
.login-logo {
    width: 52px; height: 52px; border-radius: 15px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff; font-size: 26px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .3);
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; text-align: center; font-weight: 700; }
.login-card .sub { margin: 0 0 20px; text-align: center; font-size: 13px; color: var(--muted); }
.login-card form { display: flex; flex-direction: column; gap: 13px; }
.login-foot { margin-top: 16px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------------- 提示条 ---------------- */
.alert {
    border-radius: 10px; padding: 10px 12px; font-size: 13.5px;
    display: flex; gap: 7px; align-items: flex-start;
}
.alert-err { background: var(--danger-l); border: 1px solid #f6c9c9; color: #b91c1c; }
.alert-ok  { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; }
.alert-info{ background: var(--brand-l); border: 1px solid #cddffb; color: #1e40af; }

/* ---------------- Toast ---------------- */
#toastBox {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(88px + var(--safe-b)); z-index: 200;
    display: flex; flex-direction: column; gap: 8px; align-items: center;
    pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
    background: rgba(24, 32, 46, .94); color: #fff;
    font-size: 13.5px; padding: 9px 15px; border-radius: 10px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .24);
    animation: toastIn .2s ease-out;
    max-width: 92vw; word-break: break-word;
}
.toast.ok { background: rgba(5, 118, 87, .96); }
.toast.err { background: rgba(178, 34, 34, .96); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (min-width: 768px) { #toastBox { bottom: 32px; } }

/* ---------------- 详情 / 分享页 ---------------- */
.sheet {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 15px; margin-bottom: 12px;
}
.sheet-h {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding-bottom: 11px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.sheet-h h2 { margin: 0; font-size: 17px; font-weight: 700; flex: 1 1 100%; word-break: break-word; }
@media (min-width: 768px) { .sheet-h h2 { flex: 1 1 auto; } }
.kv { display: flex; gap: 10px; font-size: 13.5px; padding: 4px 0; }
.kv .k { flex: 0 0 66px; color: var(--muted); }
.kv .v { flex: 1 1 auto; color: var(--text); word-break: break-word; }
.content-box {
    margin-top: 12px; padding: 12px;
    background: #fafbfd; border: 1px solid #eef1f6; border-radius: 10px;
    font-size: 14.5px; line-height: 1.8; color: var(--text);
    white-space: pre-wrap; word-break: break-word;
}
.att-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .att-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .att-grid { grid-template-columns: repeat(4, 1fr); } }
.att {
    border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
    background: #fbfcfe; display: flex; flex-direction: column;
}
.att .a-media {
    display: flex; align-items: center; justify-content: center;
    background: #f1f4f9; aspect-ratio: 4 / 3; overflow: hidden;
    font-size: 26px; color: var(--muted);
}
.att .a-media img { width: 100%; height: 100%; object-fit: cover; }
.att .a-media video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.att .a-info {
    padding: 7px 8px; font-size: 11.5px; color: var(--text-2);
    display: flex; flex-direction: column; gap: 2px;
}
.att .a-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .a-size { color: var(--muted); font-size: 11px; }
.att .a-act { display: flex; border-top: 1px solid var(--line); }
.att .a-act a {
    flex: 1 1 0; text-align: center; font-size: 12px; padding: 7px 0; color: var(--brand);
}
.att .a-act a + a { border-left: 1px solid var(--line); }

/* 大图/视频播放块 */
.media-block { margin-bottom: 12px; }
.media-block img, .media-block video { border-radius: 10px; display: block; width: 100%; }
.media-block audio { width: 100%; }

/* 分享页顶部提示 */
.share-banner {
    display: flex; align-items: center; gap: 8px;
    background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
    border-radius: 10px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px;
}

/* ---------------- 账号设置 ---------------- */
.card-panel {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 15px;
}
.card-panel h2 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.card-panel .cp-sub { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 768px) { .card-panel { padding: 20px 22px; } }

/* ================= 多选标签下拉（涉及客户） ================= */
.tagsel { position: relative; }

.tagsel-box {
    display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
    min-height: 44px; padding: 5px 7px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: text;
    transition: border-color .15s, box-shadow .15s;
}
.tagsel-box:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.tagsel-tags { display: contents; }

.ts-tag {
    display: inline-flex; align-items: center; gap: 2px;
    background: var(--brand-l); color: #1e40af;
    border: 1px solid #cddffb;
    border-radius: 7px;
    padding: 2px 3px 2px 8px;
    font-size: 13px; line-height: 1.6;
    max-width: 100%;
}
.ts-tag .ts-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px;
}
.ts-tag .ts-x {
    border: none; background: transparent; color: #4a7bd6;
    font-size: 15px; line-height: 1; padding: 0 4px;
    cursor: pointer; border-radius: 5px;
}
.ts-tag .ts-x:active { background: #d9e7ff; }

/* 内嵌输入框：覆盖全局 input 样式 */
.tagsel-box input.tagsel-input,
.tagsel-box input[type=text] {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 2px 4px !important;
    margin: 0;
    height: 30px;
    flex: 1 1 100px;
    min-width: 100px;
    font-size: 16px;
}
@media (min-width: 768px) {
    .tagsel-box input.tagsel-input,
    .tagsel-box input[type=text] { font-size: 14px; }
}

.tagsel-menu {
    position: absolute; left: 0; right: 0;
    top: calc(100% + 5px);
    z-index: 60;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(16, 24, 40, .15);
    max-height: 232px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
    display: none;
}
.tagsel.open .tagsel-menu { display: block; }
.tagsel.up .tagsel-menu { top: auto; bottom: calc(100% + 5px); }

.ts-opt {
    padding: 9px 10px;
    border-radius: 7px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    display: flex; align-items: center; gap: 7px;
    -webkit-user-select: none; user-select: none;
}
.ts-opt.active,
.ts-opt:hover { background: var(--brand-l); }
.ts-opt.ts-add { color: var(--brand); font-weight: 600; }
.ts-opt.ts-on { color: var(--muted); }
.ts-opt .ts-tick { color: var(--brand); font-size: 13px; }
.ts-empty {
    padding: 10px; font-size: 13px; color: var(--muted); text-align: center;
}

/* 详情页里的客户标签 */
.tagchip {
    display: inline-block;
    background: var(--brand-l); color: #1e40af;
    border: 1px solid #cddffb;
    border-radius: 7px;
    padding: 1px 9px;
    font-size: 13px;
    margin: 0 5px 4px 0;
}

/* 打印时隐藏交互件 */
@media print {
    .topbar, .rec-actions, .fab, .toolbar, .pager, #toastBox, .modal-foot { display: none !important; }
}
