/* ===========================================================
   积分兑换卡券系统 · 响应式样式表
   目标：手机 / 平板 / PC 一致体验，信息密度自适应，动画顺滑
   =========================================================== */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --success: #16a34a;
    --danger: #dc2626;
    --warn: #d97706;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 4px rgba(17, 24, 39, .05);
    --shadow: 0 4px 14px rgba(17, 24, 39, .07);
    --shadow-lg: 0 12px 32px rgba(17, 24, 39, .12);

    --ease-out: cubic-bezier(.22, .61, .36, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --duration-fast: .15s;
    --duration: .25s;
    --duration-slow: .4s;

    --header-h: 56px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0; padding: 0;
    background: var(--bg); color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px; line-height: 1.55;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; }

/* ---------- 布局 ---------- */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { padding: 20px 16px 40px; min-height: 60vh; }

.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.ta-r { text-align: right; }

.empty { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.empty a { font-weight: 600; }
.empty-icon { font-size: 52px; line-height: 1; margin-bottom: 10px; opacity: .55; animation: popIn .5s var(--ease-out) backwards; }
.empty-text { animation: slideDown .4s var(--ease-out) .08s backwards; }

/* ---------- 顶部导航 ---------- */
.app-header {
    position: sticky; top: 0; z-index: 50;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff; box-shadow: 0 2px 12px rgba(79, 70, 229, .22);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; height: var(--header-h);
}
.logo { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-size: 18px; font-weight: 700; letter-spacing: .3px; }
.logo:hover { text-decoration: none; }
.logo-icon { font-size: 20px; line-height: 1; }

/* 汉堡按钮 */
.nav-toggle {
    display: none; flex-direction: column; justify-content: center; align-items: center;
    width: 36px; height: 36px; gap: 4.5px; padding: 0;
    background: rgba(255,255,255,.14); border: none; border-radius: var(--radius-sm);
    cursor: pointer; transition: background var(--duration-fast);
}
.nav-toggle:hover { background: rgba(255,255,255,.22); }
.nav-toggle .nav-bar {
    display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px;
    transition: transform var(--duration) var(--ease-out), opacity var(--duration);
}
.nav-toggle[aria-expanded="true"] .nav-bar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-bar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* 导航 */
.nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
    display: inline-flex; align-items: center; gap: 5px;
    color: rgba(255,255,255,.9); font-size: 14px; padding: 7px 12px; border-radius: var(--radius-sm);
    position: relative; transition: background var(--duration-fast), color var(--duration-fast), transform var(--duration-fast);
    white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,.16); color: #fff; text-decoration: none; transform: translateY(-1px); }
.nav-link.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }
.nav-link .nav-icon { font-size: 15px; line-height: 1; }

.nav-divider { width: 1px; height: 22px; background: rgba(255,255,255,.25); margin: 0 6px; }

/* 用户下拉（桌面端节省空间） */
.nav-user-wrap { position: relative; }
.nav-user {
    display: inline-flex; align-items: center; gap: 6px;
    color: rgba(255,255,255,.95); font-size: 13px; padding: 4px 10px 4px 4px;
    background: rgba(255,255,255,.12); border: none; border-radius: 999px; white-space: nowrap;
    cursor: pointer; font-family: inherit; transition: background var(--duration-fast);
}
.nav-user:hover, .nav-user[aria-expanded="true"] { background: rgba(255,255,255,.20); }
.nav-avatar {
    width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.22);
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.nav-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.nav-caret { font-size: 10px; opacity: .8; transition: transform var(--duration-fast); }
.nav-user[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }

.nav-user-menu {
    position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 180px; background: #fff; color: var(--text);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 8px; opacity: 0; transform: translateY(-6px) scale(.98);
    pointer-events: none; transform-origin: top right;
    transition: opacity var(--duration-fast), transform var(--duration) var(--ease-out);
    z-index: 60;
}
.nav-user-menu.is-open { opacity: 1; transform: none; pointer-events: auto; }
.nav-user-meta {
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px 10px; margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.nav-user-meta-name { font-weight: 700; font-size: 14px; color: var(--text); }
.nav-user-meta-points { font-size: 12px; color: var(--muted); }
.nav-user-link {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    color: #374151; font-size: 14px; transition: background var(--duration-fast);
}
.nav-user-link:hover { background: #f3f4f6; text-decoration: none; }
.nav-out-link { color: var(--danger); }

.nav-public .nav-link { padding: 6px 14px; }
.nav-public .nav-link-primary { background: #fff; color: var(--primary); font-weight: 600; }
.nav-public .nav-link-primary:hover { background: rgba(255,255,255,.92); color: var(--primary-dark); }

/* ---------- 提示条 / Toast ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px;
    line-height: 1.5; box-shadow: var(--shadow-sm);
    animation: slideDown .28s var(--ease-out) backwards;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-msg { flex: 1; min-width: 0; }
.alert-close {
    flex: 0 0 auto; width: 22px; height: 22px; padding: 0; margin: -2px -4px -2px 0;
    background: transparent; border: none; color: inherit; opacity: .55; font-size: 18px; line-height: 1;
    cursor: pointer; transition: opacity var(--duration-fast), transform var(--duration-fast);
}
.alert-close:hover { opacity: 1; transform: rotate(90deg); }
.alert.is-hiding { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }

/* 浮动 Toast（由 JS 把 [data-toast=true] 的 alert 移入） */
.toast-container {
    position: fixed; z-index: 120;
    right: 16px; top: calc(var(--header-h) + 10px);
    display: flex; flex-direction: column; gap: 8px;
    max-width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}
.toast-container .alert {
    pointer-events: auto; margin: 0;
    animation: toastIn .32s var(--ease-out) backwards;
    box-shadow: var(--shadow-lg);
}
.toast-container .alert.is-hiding { transform: translateX(120%); opacity: 0; }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px) scale(.96); }
    to { opacity: 1; transform: none; }
}
@media (max-width: 680px) {
    .toast-container { right: 12px; left: 12px; top: calc(var(--header-h) + 8px); max-width: none; }
    .toast-container .alert { width: 100%; }
}

/* ---------- 卡片 ---------- */
.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px;
    transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
    animation: rise var(--duration-slow) var(--ease-out) backwards;
}
.card-title { margin: 0 0 6px; font-size: 18px; }

.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-coupon { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.section-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px; margin: 0 0 14px;
    animation: slideDown .3s var(--ease-out) backwards;
}
.section-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.section-head .muted { font-size: 13px; }

/* ---------- 积分横幅 ---------- */
.points-banner {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff; border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
    box-shadow: var(--shadow-lg); animation: rise .5s var(--ease-out) backwards;
}
.points-banner-main { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.points-banner-main .label { font-size: 13px; opacity: .9; margin-right: 4px; }
.points-banner-main .num { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.points-banner-main .unit { font-size: 14px; opacity: .9; }
.points-banner-side p { margin: 2px 0; font-size: 13px; }
.points-banner-side .muted { color: rgba(255,255,255,.82); }
.btn-light { background: #fff; color: var(--primary); }
.btn-light:hover { background: #f9fafb; }
.btn-points-detail { margin-left: 8px; padding: 5px 12px; font-size: 12px; }

/* ---------- 入口卡片 ---------- */
.entry-card { display: flex; align-items: center; gap: 14px; padding: 16px; color: var(--text); }
.entry-card:hover { text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.entry-icon { font-size: 28px; line-height: 1; flex: 0 0 auto; }
.entry-body { flex: 1; min-width: 0; }
.entry-title { font-weight: 700; font-size: 15px; }
.entry-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- 卡券卡片 ---------- */
.coupon-card { display: flex; flex-direction: column; padding: 16px; }
.coupon-card.is-expired { opacity: .72; }
.coupon-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.coupon-name { margin: 0; font-size: 16px; line-height: 1.35; }
.cost { color: var(--primary); font-weight: 800; font-size: 20px; white-space: nowrap; }
.cost small { font-size: 11px; font-weight: 500; margin-left: 2px; }
.cost-mini { color: var(--primary); font-weight: 700; }
.coupon-desc { color: #374151; font-size: 13px; margin: 8px 0 6px; flex: 1; line-height: 1.5; }
.coupon-expire { color: var(--muted); font-size: 12px; margin: 0 0 4px; display: flex; align-items: center; gap: 4px; }
.coupon-foot { margin-top: 10px; }

/* ---------- 状态徽章 ---------- */
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; font-weight: 600; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-blue { background: var(--primary-light); color: var(--primary); }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-block; border: none; cursor: pointer; font-size: 14px;
    padding: 8px 14px; border-radius: var(--radius-sm); background: #e5e7eb; color: #374151;
    transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast), background var(--duration-fast), color var(--duration-fast);
    text-align: center; font-family: inherit; line-height: 1.4;
    will-change: transform;
}
.btn:hover { filter: brightness(.97); text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(17,24,39,.1); }
.btn:active { transform: scale(.97); box-shadow: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn { background: #fff7ed; border: 1px solid #fed7aa; color: var(--warn); }
.btn-ghost { background: #f3f4f6; color: #374151; }
.btn-disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { width: 100%; display: block; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.inline-form { display: inline-block; margin-left: 6px; }

.btn.is-loading { opacity: .8; cursor: progress; transform: none; }
.btn.is-loading::after {
    content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 6px;
    border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
    border-radius: 50%; vertical-align: -2px; animation: spin .7s linear infinite;
}
.btn-outline.is-loading::after, .btn-ghost.is-loading::after {
    border-color: rgba(79,70,229,.3); border-top-color: var(--primary);
}

/* ---------- 表单 ---------- */
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1 1 auto; min-width: 0; }
.input-group select { flex: 0 0 96px; width: 96px; }
.auth-wrap { display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 400px; }
.form-card { max-width: 560px; }
.form-item { margin-bottom: 12px; }
.form-item label { display: block; font-size: 14px; margin-bottom: 5px; font-weight: 600; }
.form-item label i { color: var(--danger); font-style: normal; }
.form-item input, .form-item select, .form-item textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 15px; font-family: inherit; background: #fff; color: var(--text); outline: none;
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.form-item textarea { resize: vertical; }

/* ---------- 二维码 / 核销码 ---------- */
.qr-box {
    margin-top: 10px; padding: 10px; background: #f9fafb; border: 1px dashed var(--border);
    border-radius: var(--radius); display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.qr-box-off { opacity: .6; }
.qr-img { position: relative; flex: 0 0 auto; line-height: 0; }
.qr-img svg { display: block; border-radius: var(--radius-sm); background: #fff; padding: 4px; box-shadow: var(--shadow-sm); }
.qr-stamp {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-14deg);
    padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: 800; letter-spacing: 2px;
    border: 2px solid currentColor; background: rgba(255,255,255,.86); line-height: 1.2;
}
.qr-stamp-used { color: #6b7280; }
.qr-stamp-expired { color: #b91c1c; }
.qr-info { flex: 1 1 140px; min-width: 140px; display: flex; flex-direction: column; gap: 5px; }
.qr-label { font-size: 12px; color: var(--muted); }
.qr-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px; font-weight: 700; letter-spacing: 1px; color: var(--text);
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 8px;
    display: inline-block; word-break: break-all;
}
.qr-tip { font-size: 12px; color: var(--muted); }
.btn-mini { padding: 3px 8px; font-size: 11px; border-radius: 6px; align-self: flex-start; }
.btn-lg { padding: 12px 22px; font-size: 15px; }

/* ---------- 扫码核销页 ---------- */
.scan-card { padding: 14px; }
.scan-row { display: flex; gap: 8px; flex-wrap: wrap; }
.scan-input {
    flex: 1 1 240px; min-width: 200px; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 16px; font-family: inherit; outline: none; letter-spacing: 1px;
}
.scan-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.scan-hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.scan-camera { margin-top: 12px; text-align: center; }
.scan-camera video { width: 100%; max-width: 320px; border-radius: var(--radius); background: #111827; }
.scan-mask { color: var(--muted); font-size: 13px; margin: 8px 0; }

.verify-card { padding: 16px; border-left: 4px solid var(--primary); }
.verify-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.verify-title { margin: 0 0 6px; font-size: 17px; }
.verify-qr { flex: 0 0 auto; }
.verify-qr svg { border-radius: var(--radius-sm); background: #fff; }
.verify-table { width: 100%; border-collapse: collapse; margin: 12px 0 14px; font-size: 14px; }
.verify-table th, .verify-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.verify-table th { width: 92px; color: var(--muted); font-weight: 600; font-size: 13px; }
.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.data-table th, .data-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 13px; background: #fafafa; }
.data-table tbody tr:hover { background: #f9fafb; }

/* ---------- 表格 ---------- */
.table-card { padding: 6px 10px 10px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.table th, .table td { padding: 11px 9px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; background: #fafafa; }
.table tbody tr { transition: background var(--duration-fast); }
.table tbody tr:hover { background: #f9fafb; }
.td-desc { color: #4b5563; max-width: 320px; }

/* ---------- 后台布局 ---------- */
.admin-wrap { display: flex; gap: 16px; padding-top: 20px; padding-bottom: 30px; align-items: flex-start; }
.admin-side {
    width: 200px; flex: 0 0 200px; background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 3px;
}
.admin-side a { padding: 9px 11px; border-radius: var(--radius-sm); color: #374151; font-size: 14px; transition: background var(--duration-fast), transform var(--duration-fast), color var(--duration-fast); }
.admin-side a:hover { background: var(--primary-light); text-decoration: none; transform: translateX(2px); }
.admin-side a.active { background: var(--primary); color: #fff; font-weight: 600; }
.admin-main { flex: 1; min-width: 0; }

/* ---------- 弹窗 ---------- */
.modal {
    position: fixed; inset: 0; background: rgba(17, 24, 39, .5);
    display: none; align-items: center; justify-content: center; z-index: 99; padding: 16px;
    opacity: 0; transition: opacity var(--duration);
}
.modal.show { display: flex; opacity: 1; }
.modal-box {
    background: #fff; border-radius: var(--radius-lg); padding: 20px; width: 100%; max-width: 460px;
    max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .2);
    transform: translateY(16px) scale(.97); transition: transform var(--duration) var(--ease-out);
}
.modal.show .modal-box { transform: none; }
.modal-box h3 { margin: 0 0 12px; font-size: 17px; }
.modal-line { margin: 5px 0; font-size: 14px; color: #374151; }
.modal-list { margin: 5px 0 10px; padding-left: 20px; font-size: 14px; color: #4b5563; }
.modal-list li { margin: 3px 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.modal-actions.left { justify-content: flex-start; align-items: center; }

/* ---------- 页脚 ---------- */
.app-footer { padding: 18px 16px 28px; color: var(--muted); font-size: 12px; text-align: center; }
.app-footer p { margin: 3px 0; }

/* ===========================================================
   新组件样式：分段标签 / 堆叠卡券 / 分页 / 筛选 / 公告 / 上传 / 导入
   =========================================================== */

/* ---------- 分段切换 ---------- */
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg-tabs {
    display: inline-flex; gap: 3px; padding: 3px;
    background: #f3f4f6; border-radius: 999px; flex-wrap: wrap;
}
.seg-tab {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 14px; border-radius: 999px; font-size: 13px; color: #4b5563;
    transition: background var(--duration-fast), color var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
}
.seg-tab:hover { background: #e5e7eb; text-decoration: none; }
.seg-tab.active {
    background: #fff; color: var(--primary); font-weight: 600;
    box-shadow: var(--shadow-sm); transform: translateY(-1px);
}
.tab-num {
    display: inline-block; min-width: 18px; padding: 0 4px;
    background: rgba(79, 70, 229, .1); color: var(--primary);
    border-radius: 999px; font-size: 11px; text-align: center;
}
.my-tabs { margin: 0 0 14px; }

/* ---------- 堆叠卡券（同随机码合并） ---------- */
.stack-card { padding: 14px 16px; }
.stack-card.open { border-color: rgba(79, 70, 229, .28); }
.stack-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.stack-main { flex: 1; min-width: 0; }
.stack-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack-title { margin: 0; font-size: 16px; line-height: 1.35; }
.stack-count {
    padding: 2px 8px; border-radius: 999px; font-size: 11px;
    background: var(--primary-light); color: var(--primary); font-weight: 600;
}
.stack-desc { margin: 6px 0 4px; color: #4b5563; font-size: 13px; line-height: 1.5; }
.stack-meta { margin: 3px 0; color: var(--muted); font-size: 12px; }
.stack-meta .remain { color: var(--primary); font-weight: 600; }
.stack-code { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.stack-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 0 0 auto; }
.stack-thumbs { display: flex; align-items: flex-end; gap: 5px; }
.thumb-qr {
    padding: 3px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast);
}
.thumb-qr svg { display: block; width: 40px; height: 40px; }
.stack-card:hover .thumb-qr { transform: translateY(-2px); }
.thumb-used { opacity: .45; filter: grayscale(1); }
.thumb-expired { opacity: .5; filter: grayscale(.85); }
.thumb-more {
    width: 40px; height: 40px; border-radius: var(--radius-sm); background: #f3f4f6; color: var(--muted);
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}

/* 展开区：逐张卡券 */
.stack-body {
    margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border);
    display: grid; gap: 10px;
    animation: expandIn .32s var(--ease-out) backwards;
}
.stack-card.is-open .stack-body { animation: expandIn .28s var(--ease-out) backwards; }
@keyframes expandIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* 桌面端默认展开完整信息；手机端默认折叠，点击展开 */
@media (max-width: 680px) {
    .stack-body {
        display: none;
        margin-top: 0; padding-top: 0; border-top: none;
    }
    .stack-card.is-open .stack-body {
        display: grid;
        margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border);
    }
    .stack-card.single .stack-body { display: grid; }
}

.uc-item {
    display: flex; gap: 12px; padding: 12px; border-radius: var(--radius);
    background: #fafafa; border: 1px solid var(--border);
    transition: background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
}
.uc-item:hover { background: #f5f6ff; border-color: #c7d2fe; }
.uc-item.is-used { background: #f9fafb; }
.uc-item.is-expired { background: #fef6f6; }
.uc-qr {
    position: relative; flex: 0 0 auto; padding: 5px; background: #fff;
    border: 1px solid var(--border); border-radius: var(--radius-sm); align-self: flex-start;
}
.uc-qr svg { display: block; width: 96px; height: 96px; }
.uc-info { flex: 1; min-width: 0; font-size: 13px; }
.uc-line { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.uc-no { color: var(--muted); font-size: 11px; }
.uc-code { margin: 3px 0; color: var(--muted); font-size: 12px; }
.uc-meta { color: var(--muted); line-height: 1.65; font-size: 12px; }
.uc-del { margin-top: 8px; }

.qr-stamp {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-12deg);
    padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 700;
    letter-spacing: 1px; pointer-events: none;
}
.stamp-gray { background: rgba(75, 85, 99, .88); color: #fff; }
.stamp-red { background: rgba(220, 38, 38, .88); color: #fff; }

/* ---------- 通用小组件 ---------- */
.code-chip {
    display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 12px;
    background: #f3f4f6; color: #374151; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.btn-copy { margin-left: 5px; }
.btn-toggle { white-space: nowrap; }
.row-dim { opacity: .62; }
.txt-up { color: #16a34a; }
.txt-down { color: #dc2626; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-row select, .form-row input { padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; }
.form-row input[type="number"] { width: 110px; }
.form-row input[type="text"] { flex: 1; min-width: 160px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 12px 4px 2px; }
.pager-btn {
    min-width: 32px; padding: 5px 9px; border-radius: var(--radius-sm); font-size: 13px;
    border: 1px solid var(--border); color: #374151; background: #fff;
    transition: background var(--duration-fast), color var(--duration-fast), transform var(--duration-fast), border-color var(--duration-fast);
}
.pager-btn:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; transform: translateY(-1px); }
.pager-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.pager-btn.disabled { opacity: .4; pointer-events: none; }
.pager-dot { color: var(--muted); padding: 0 2px; }
.pager-info { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- 筛选表单 ---------- */
.filter-card { padding: 14px 16px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.filter-grid .form-item { margin: 0; }
.filter-form .modal-actions { margin-top: 10px; }

/* ---------- 公告 ---------- */
.announce-list { display: grid; gap: 12px; }
.announce-card { padding: 14px 16px; border-left: 3px solid var(--primary); }
.announce-title { margin: 0 0 6px; font-size: 15px; }
.announce-content { font-size: 14px; color: #374151; line-height: 1.75; white-space: pre-wrap; }
.announce-foot { margin-top: 8px; font-size: 12px; }

/* ---------- 上传核销 ---------- */
.upload-box {
    margin-top: 14px; padding: 12px 14px; background: #f9fafb;
    border: 1px dashed var(--border); border-radius: var(--radius);
}
.upload-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.upload-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.upload-form input[type="file"] {
    flex: 1; min-width: 200px; padding: 7px; font-size: 13px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff;
}

/* ---------- 导入说明 ---------- */
.tips-list { margin: 0 0 12px; padding-left: 20px; font-size: 14px; color: #4b5563; line-height: 1.8; }
.tips-list li { margin: 3px 0; }

/* ===========================================================
   动画与交互增强
   =========================================================== */

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-soft { 0%,100%{ opacity: 1; } 50%{ opacity: .7; } }

/* 顶部加载进度条 */
#pageProgress {
    position: fixed; top: 0; left: 0; height: 2.5px; width: 0;
    background: linear-gradient(90deg, #818cf8, #c084fc);
    z-index: 200; pointer-events: none; opacity: 0;
    transition: width .28s ease, opacity .2s ease;
    border-radius: 0 2px 2px 0;
}
#pageProgress.active { opacity: 1; width: 72%; }

/* 卡片 / 区块入场（错峰） */
.grid > *:nth-child(1) { animation-delay: .02s; }
.grid > *:nth-child(2) { animation-delay: .05s; }
.grid > *:nth-child(3) { animation-delay: .08s; }
.grid > *:nth-child(4) { animation-delay: .11s; }
.grid > *:nth-child(5) { animation-delay: .14s; }
.grid > *:nth-child(6) { animation-delay: .17s; }
.grid > *:nth-child(7) { animation-delay: .20s; }
.grid > *:nth-child(8) { animation-delay: .23s; }

.section-head { animation-name: slideDown; animation-duration: .3s; }
.points-banner-main .num { animation: popIn .5s var(--ease-out) backwards; }

/* 内联表单面板 */
.form-panel {
    animation: popIn .32s var(--ease-out) backwards;
    border: 1px solid rgba(79, 70, 229, .32);
    box-shadow: 0 10px 30px rgba(79, 70, 229, .1);
}

/* 导航下划线动画 */
.nav-link::after {
    content: ''; position: absolute; left: 10px; right: 10px; bottom: 4px; height: 2px;
    background: #fff; border-radius: 2px; transform: scaleX(0); transform-origin: center;
    transition: transform .2s var(--ease-out);
}
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

/* 卡券卡片悬浮 */
.coupon-card, .entry-card { transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out); }
.coupon-card:hover, .entry-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* 表单控件聚焦 */
.form-item input, .form-item select, .form-item textarea { transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }

/* 按钮涟漪效果 */
.btn { position: relative; overflow: hidden; }
.btn .ripple {
    position: absolute; border-radius: 50%; background: rgba(255,255,255,.35);
    transform: scale(0); animation: ripple .55s linear; pointer-events: none;
}
.btn-primary .ripple, .btn-danger .ripple { background: rgba(255,255,255,.4); }
.btn-outline .ripple, .btn-ghost .ripple { background: rgba(79,70,229,.18); }
@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

/* 页面整体淡入 */
body > .app-header { animation: slideDown .3s var(--ease-out) backwards; }
body > .main { animation: fadeIn .35s var(--ease-out) backwards; animation-delay: .06s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 尊重系统「减少动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
    .modal, .modal-box { transition: none; }
}

/* ===========================================================
   响应式：桌面 / 平板 / 手机
   =========================================================== */

/* 平板：提前折叠导航，避免顶部换行 */
@media (max-width: 900px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .admin-wrap { flex-direction: column; }
    .admin-side { width: 100%; flex: none; flex-direction: row; overflow-x: auto; }
    .admin-side a { white-space: nowrap; }

    .nav-toggle { display: flex; }
    .nav {
        position: absolute; left: 0; right: 0; top: var(--header-h);
        flex-direction: column; align-items: stretch; gap: 2px;
        background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
        padding: 8px 12px 16px; box-shadow: 0 12px 24px rgba(79,70,229,.22);
        transform-origin: top; transform: scaleY(0); opacity: 0; pointer-events: none;
        transition: transform .28s var(--ease-out), opacity .22s ease;
    }
    .nav.is-open { transform: scaleY(1); opacity: 1; pointer-events: auto; }
    .nav-link { padding: 11px 12px; border-radius: var(--radius-sm); font-size: 15px; }
    .nav-link .nav-icon { width: 22px; text-align: center; }
    .nav-divider { width: auto; height: 1px; margin: 6px 0; background: rgba(255,255,255,.18); }

    /* 用户下拉在移动端变为菜单项 */
    .nav-user-wrap { width: 100%; }
    .nav-user {
        width: 100%; justify-content: flex-start;
        padding: 10px 12px; background: rgba(255,255,255,.10); border-radius: var(--radius-sm);
    }
    .nav-user-menu {
        position: static; opacity: 1; transform: none; pointer-events: auto;
        background: rgba(0,0,0,.12); box-shadow: none; padding: 0 4px 4px;
        display: none; margin-top: 2px;
    }
    .nav-user-menu.is-open { display: block; }
    .nav-user-meta { border-bottom-color: rgba(255,255,255,.15); color: #fff; }
    .nav-user-meta-name { color: #fff; }
    .nav-user-meta-points { color: rgba(255,255,255,.8); }
    .nav-user-link { color: #fff; }
    .nav-user-link:hover { background: rgba(255,255,255,.12); }
    .nav-name { max-width: none; }
    .nav-caret { margin-left: auto; }
}

/* 手机 */
@media (max-width: 680px) {
    :root { --header-h: 50px; }
    body { font-size: 14px; }
    .container { padding: 0 12px; }
    .main { padding: 12px 12px 28px; }
    .card { padding: 12px; border-radius: var(--radius-sm); }

    .logo { font-size: 16px; }
    .logo-text { display: inline; }

    /* 积分横幅 */
    .points-banner { padding: 14px; flex-direction: column; align-items: flex-start; gap: 10px; border-radius: var(--radius-sm); }
    .points-banner-main .num { font-size: 30px; }
    .points-banner-main .label { width: 100%; }
    .btn-points-detail { margin-left: 0; margin-top: 2px; }
    .points-banner-side p { font-size: 12px; }

    /* 入口卡片 */
    .grid-3 { grid-template-columns: 1fr; }
    .entry-card { padding: 12px; gap: 12px; }
    .entry-icon { font-size: 22px; }
    .entry-title { font-size: 14px; }
    .entry-desc { font-size: 11px; }

    /* 卡券商城 */
    .grid-coupon { grid-template-columns: 1fr; }
    .coupon-card { padding: 12px; }
    .coupon-name { font-size: 15px; }
    .cost { font-size: 18px; }

    /* 分段标签：可横向滚动，避免换行 */
    .seg-tabs {
        width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
        -webkit-overflow-scrolling: touch; padding: 3px; gap: 2px;
        mask-image: linear-gradient(to right, #000 92%, transparent 100%);
    }
    .seg-tabs::-webkit-scrollbar { display: none; }
    .seg-tab { flex: 0 0 auto; justify-content: center; padding: 6px 12px; font-size: 13px; }
    .my-tabs { margin-bottom: 12px; }

    /* 堆叠卡券：手机端紧凑，点击展开 */
    .stack-card { padding: 12px; }
    .stack-head { flex-direction: row; gap: 8px; align-items: center; }
    .stack-main { min-width: 0; }
    .stack-top { gap: 6px; }
    .stack-title { font-size: 14px; }
    .stack-count { font-size: 10px; padding: 1px 6px; }
    .stack-desc { margin: 4px 0 2px; font-size: 12px; }
    .stack-meta { margin: 2px 0; font-size: 11px; }
    .stack-code { margin: 6px 0 0; font-size: 11px; }
    .stack-side { align-items: flex-end; }
    .stack-thumbs { display: none; } /* 手机端隐藏缩略二维码，展开后看大图 */
    .btn-toggle { padding: 4px 8px; font-size: 11px; }

    .uc-item { flex-direction: column; align-items: stretch; gap: 10px; padding: 10px; }
    .uc-qr { align-self: center; }
    .uc-qr svg { width: 140px; height: 140px; }
    .uc-info { width: 100%; }

    /* 表格在手机上转为卡片式布局 */
    .table { min-width: 100%; }
    .table thead { display: none; }
    .table tr { display: block; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 8px 0; padding: 4px 10px; }
    .table td { display: flex; justify-content: space-between; gap: 12px; border: none; padding: 6px 0; font-size: 13px; }
    .table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: 0 0 76px; }
    .table td.ta-r, .table th.ta-r { text-align: left; }
    .table-card { padding: 4px 6px 10px; }

    /* 弹窗 */
    .modal-box { padding: 16px; border-radius: var(--radius); }

    /* 分页 */
    .pager-info { margin-left: 0; width: 100%; font-size: 12px; }

    /* 筛选 */
    .filter-grid { grid-template-columns: 1fr; }

    /* 空状态 */
    .empty { padding: 28px 12px; }
    .empty-icon { font-size: 42px; margin-bottom: 8px; }
}

/* 小屏手机 */
@media (max-width: 360px) {
    .logo-text { display: none; }
    .points-banner-main .num { font-size: 26px; }
    .uc-qr svg { width: 120px; height: 120px; }
    .seg-tab { font-size: 12px; padding: 5px 10px; }
}

/* ---------- 积分明细：手机端卡片 ---------- */
.points-list-mobile { display: none; }
.point-card {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 14px; margin: 8px 0; background: #fff;
    transition: box-shadow var(--duration-fast), border-color var(--duration-fast);
    cursor: pointer;
}
.point-card:hover { border-color: #c7d2fe; box-shadow: var(--shadow-sm); }
.point-card.is-open { border-color: var(--primary); }
.point-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.point-card-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.point-time { font-size: 13px; color: var(--muted); }
.point-card-right { display: flex; align-items: center; gap: 8px; }
.point-change { font-size: 16px; }
.point-arrow { font-size: 11px; color: var(--muted); transition: transform var(--duration-fast); }
.point-card.is-open .point-arrow { transform: rotate(180deg); }
.point-card-body {
    display: none; margin-top: 10px; padding-top: 10px;
    border-top: 1px dashed var(--border); font-size: 13px;
    animation: expandIn .25s var(--ease-out) backwards;
}
.point-card.is-open .point-card-body { display: block; }
.point-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.point-row .point-label { color: var(--muted); flex: 0 0 64px; }
.point-row span:last-child { flex: 1; text-align: right; word-break: break-all; }

@media (max-width: 680px) {
    .points-table-desktop { display: none; }
    .points-list-mobile { display: block; }
}

/* ===========================================================
   工单中心（用户 + 后台）· 响应式样式
   =========================================================== */

/* 优先级徽标：高=橙 紧急=红（普通/低复用既有蓝/灰） */
.badge-warn { background: #fff1e0; color: #c2680a; }
.badge-orange { background: #fff1e0; color: #c2680a; }

/* 状态标签 */
.ticket-status { font-size: 12px; padding: 2px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.ticket-status.is-open  { background: #dcfce7; color: #15803d; }
.ticket-status.is-closed { background: #eceff3; color: #6b7280; }

/* 分段标签计数 */
.seg-tab .tab-count {
    display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
    font-size: 11px; line-height: 16px; text-align: center;
    background: rgba(79,70,229,.12); color: var(--primary); border-radius: 999px;
}
.seg-tab.active .tab-count { background: rgba(255,255,255,.28); color: #fff; }

/* 列表：桌面多列网格，手机单列 */
.ticket-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ticket-card {
    display: block; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; box-shadow: var(--shadow-sm);
    transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out), border-color var(--duration-fast);
    animation: rise var(--duration-slow) var(--ease-out) backwards;
}
.ticket-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #c7d2fe; }
.ticket-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ticket-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.4; word-break: break-word; }
.ticket-snippet { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.5; max-height: 42px; overflow: hidden; }
.ticket-card-meta { margin-top: 10px; display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); }
.ticket-time { white-space: nowrap; }
.ticket-imgs { white-space: nowrap; }

/* 详情页头部 */
.section-head.ticket-detail-head { flex-wrap: wrap; gap: 10px; }
.back-link { color: var(--primary); font-size: 14px; font-weight: 600; }
.back-link:hover { text-decoration: none; }
.ticket-head-card { padding: 16px; }
.ticket-title-lg { margin: 0 0 8px; font-size: 18px; line-height: 1.4; word-break: break-word; }
.ticket-meta-row { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }

/* 发单人信息卡（后台） */
.ticket-owner-card { padding: 14px 16px; }
.owner-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.owner-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; }
.owner-item { display: flex; flex-direction: column; gap: 2px; }
.owner-label { font-size: 12px; color: var(--muted); }
.owner-value { font-size: 14px; font-weight: 600; word-break: break-all; }

/* 沟通时间线 */
.ticket-thread-card { padding: 12px 14px; }
.ticket-thread { display: flex; flex-direction: column; gap: 4px; }
.msg { display: flex; margin: 8px 0; }
.msg-user  { justify-content: flex-start; }
.msg-admin { justify-content: flex-end; }
.msg-bubble {
    max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 14px;
    box-shadow: var(--shadow-sm); animation: rise .3s var(--ease-out) backwards;
}
.msg-user .msg-bubble  { background: #f1f5f9; border-top-left-radius: 4px; }
.msg-admin .msg-bubble  { background: var(--primary-light); border-top-right-radius: 4px; }
.msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.msg-name { font-weight: 600; color: var(--text); }
.msg-text { white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.msg-images { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.msg-img-wrap { display: block; }
.msg-img-wrap img {
    width: 110px; height: 110px; object-fit: cover; border-radius: 8px;
    border: 1px solid var(--border); background: #fff; transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}
.msg-img-wrap:hover img { transform: scale(1.04); box-shadow: var(--shadow); }

/* 回复 / 操作区 */
.ticket-reply-card, .ticket-delete-card, .ticket-closed-tip { padding: 16px; }
.ticket-closed-tip { color: var(--muted); font-size: 14px; text-align: center; }
.ticket-delete-card p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }

/* 图片上传预览 */
.img-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.img-preview .pv {
    position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--border); background: #f8fafc;
}
.img-preview .pv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-preview .pv .pv-del {
    position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; line-height: 16px; text-align: center;
    background: rgba(0,0,0,.6); color: #fff; border-radius: 50%; font-size: 12px; cursor: pointer; border: none; padding: 0;
}

/* 表单卡片内的必填星号 */
.req { color: var(--danger); margin-left: 2px; }

/* 小号按钮 / 危险按钮（详情页与列表操作复用） */
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-outline { background: #fff; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; border: 1px solid var(--danger); }
.btn-danger:hover { background: #b91c1c; color: #fff; text-decoration: none; }

/* 后台手机端卡片列表：默认隐藏，手机端显示 */
.ticket-list-mobile { display: none; }

/* 后台列表：手机端表格转卡片 */
@media (max-width: 680px) {
    .ticket-table-desktop { display: none; }
    .ticket-list-mobile { display: grid; grid-template-columns: 1fr; gap: 12px; }
    .ticket-list { grid-template-columns: 1fr; }
    .owner-grid { grid-template-columns: 1fr; }
    .msg-bubble { max-width: 88%; }
    .msg-img-wrap img { width: 88px; height: 88px; }
    .section-head.ticket-detail-head .back-link { width: 100%; }
}
@media (max-width: 360px) {
    .msg-img-wrap img { width: 72px; height: 72px; }
}

/* ===================== 话术面板（工单回复页一键填入，可折叠） ===================== */
.script-panel {
    margin: 4px 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
}
.script-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 12px; background: var(--bg-soft, #f8fafc);
    cursor: pointer; list-style: none; user-select: none;
}
.script-panel-head::-webkit-details-marker { display: none; }
.script-panel-title { font-size: 13px; font-weight: 600; color: var(--muted); }
.script-count {
    font-size: 11px; min-width: 18px; height: 18px; line-height: 18px; text-align: center;
    padding: 0 6px; border-radius: 999px; background: var(--primary-light); color: var(--primary);
}
.script-toggle {
    width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent;
    border-top: 6px solid var(--muted); transition: transform var(--duration-fast);
}
.script-panel[open] .script-toggle { transform: rotate(180deg); }
.script-panel-body { padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.script-search {
    width: 100%; padding: 6px 10px; font-size: 13px; margin-bottom: 8px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff;
}
.script-list { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.script-item {
    border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; cursor: pointer;
    background: #fff; transition: background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
}
.script-item:hover { background: var(--primary-light); border-color: var(--primary); transform: translateY(-1px); }
.script-item-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.script-item-cat { font-size: 11px; color: var(--primary); font-weight: 500; }
.script-item-content {
    font-size: 13px; color: var(--muted); margin-top: 4px;
    white-space: pre-wrap; word-break: break-word; max-height: 42px; overflow: hidden;
}
.script-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.script-tag {
    font-size: 11px; padding: 1px 8px; border-radius: 999px;
    background: var(--primary-light); color: var(--primary);
}
.script-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ===================== 实时更新：内容刷新高亮 ===================== */
.rt-updated { animation: rtFlash 1.2s ease-out; }
@keyframes rtFlash {
    0%   { box-shadow: 0 0 0 2px var(--primary); background: var(--primary-light); }
    100% { box-shadow: 0 0 0 0 transparent; background: transparent; }
}

/* ===================== 话术库管理界面 ===================== */
.scripts-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.scripts-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.filter-form select, .filter-form input[type="text"] {
    padding: 5px 10px; font-size: 13px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: #fff; max-width: 180px;
}
.scripts-head { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.scripts-form-title { margin: 0 0 14px; font-size: 16px; }
.script-manage-list { display: flex; flex-direction: column; gap: 10px; }
.script-manage-item {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
}
.script-manage-main { min-width: 0; flex: 1; }
.script-manage-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.script-manage-content { font-size: 13px; color: var(--text); margin-top: 4px; white-space: pre-wrap; line-height: 1.5; word-break: break-word; }
.script-manage-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.script-manage-actions { display: flex; gap: 6px; flex-shrink: 0; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-item { flex: 1; min-width: 160px; }

@media (max-width: 680px) {
    .script-manage-item { flex-direction: column; }
    .script-manage-actions { width: 100%; }
    .script-manage-actions .btn { flex: 1; text-align: center; }
    .script-panel-head { flex-wrap: wrap; }
    .script-search { max-width: 100%; }
}

/* ===================== 工单对话：核销码识别 + 在线核销入口 ===================== */
.code-entries {
    margin-top: 8px; display: flex; flex-direction: column; gap: 6px;
}
.code-entry {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    padding: 7px 10px; border: 1px dashed var(--border); border-radius: 9px;
    background: var(--bg-soft, #f8fafc);
    animation: codeIn .32s var(--ease-out) backwards;
}
.code-entry.code-ok      { border-color: #a7f3d0; background: #f0fdf4; }
.code-entry.code-used    { border-color: var(--border); background: #f9fafb; }
.code-entry.code-expired,
.code-entry.code-invalid { border-color: #fecaca; background: #fef2f2; }
.code-tag { font-size: 12px; color: var(--text); }
.code-tag code {
    font-size: 12px; padding: 1px 6px; border-radius: 5px;
    background: #fff; border: 1px solid var(--border); word-break: break-all;
}
.code-verify-form { margin: 0; }
.code-details { margin-left: auto; }
.code-details[open] .code-toggle { transform: rotate(180deg); }
.code-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 6px; cursor: pointer; list-style: none;
    color: var(--muted); font-size: 12px; background: #fff; border: 1px solid var(--border);
    transition: transform var(--duration-fast), background var(--duration-fast);
}
.code-toggle::-webkit-details-marker { display: none; }
.code-toggle:hover { background: var(--primary-light); color: var(--primary); }
.code-detail-body {
    margin-top: 8px; padding: 10px 12px; background: #fff;
    border: 1px solid var(--border); border-radius: 8px;
    animation: expandIn .26s var(--ease-out) backwards;
}
.code-detail-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.code-detail-table th,
.code-detail-table td {
    text-align: left; padding: 4px 8px; border-bottom: 1px solid #f3f4f6; vertical-align: top;
}
.code-detail-table th { width: 84px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.code-detail-table td { word-break: break-all; }
.code-detail-table tr:last-child th,
.code-detail-table tr:last-child td { border-bottom: 0; }
@keyframes codeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 680px) {
    .code-details { margin-left: 0; }
    .code-detail-table th { width: 72px; }
}

/* ===================== 流畅度 / 动画增强 ===================== */
/* 卡片错峰入场（基础态可见，动画仅在支持时播放，prefers-reduced-motion 下自动跳过） */
.card, .ticket-card, .script-manage-item, .stack-card {
    transition: box-shadow var(--duration-fast), transform var(--duration-fast), border-color var(--duration-fast);
}
#main > .card:nth-child(1), #main > .ticket-card:nth-child(1) { animation-delay: .02s; }
#main > .card:nth-child(2), #main > .ticket-card:nth-child(2) { animation-delay: .06s; }
#main > .card:nth-child(3), #main > .ticket-card:nth-child(3) { animation-delay: .10s; }
#main > .card:nth-child(4), #main > .ticket-card:nth-child(4) { animation-delay: .14s; }
#main > .card:nth-child(n+5), #main > .ticket-card:nth-child(n+5) { animation-delay: .18s; }

/* 工单气泡入场 */
.msg { animation: msgIn .34s var(--ease-out) backwards; }
.msg:nth-child(2) { animation-delay: .04s; }
.msg:nth-child(3) { animation-delay: .08s; }
.msg:nth-child(n+4) { animation-delay: .12s; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* 表格行悬停更顺滑 */
.data-table tbody tr { transition: background var(--duration-fast); }
.data-table tbody tr:hover { background: var(--bg-soft, #f8fafc); }

/* 标签切换 / 徽章平滑 */
.seg-tab, .badge, .tab-count, .code-toggle, .script-item {
    transition: background var(--duration-fast), color var(--duration-fast),
                border-color var(--duration-fast), transform var(--duration-fast);
}
.script-manage-item:hover, .stack-card:hover {
    border-color: #c7d2fe; box-shadow: var(--shadow-sm);
}

/* 实时刷新：内容区轻微淡入，弱化突兀感 */
.rt-updated > * { animation: fadeIn .3s var(--ease-out) backwards; }

/* 顶部「实时」指示点 */
.rt-live {
    display: inline-flex; align-items: center; gap: 5px; margin-left: 10px;
    font-size: 11px; color: var(--muted);
}
.rt-live i {
    width: 6px; height: 6px; border-radius: 50%; background: #22c55e;
    animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }
