/* 本地独立样式文件，替换Tailwind CDN */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 30px;
}
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e8ecf1;
}
/* 背景样式 */
.bg-gray-50 { background-color: #f9fafb; }
.bg-white { background-color: #ffffff; }
.bg-red-50 { background-color: #fef2f2; }
.bg-indigo-50 { background-color: #eef2ff; }
.bg-indigo-600 { background-color: #4f46e5; }
.bg-gradient-to-br {
    background: linear-gradient(135deg, #e0e7ff 0%, #faf5ff 50%, #fce7f3 100%);
    min-height: 100vh;
}

/* 布局Flex */
.min-h-screen { min-height: 100vh; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-grow { flex-grow: 1; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* 容器 */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}
.max-w-7xl { max-width: 80rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-md { max-width: 28rem; }
.w-full { width: 100%; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }
.h-4 { height: 1rem; }
.w-4 { width: 1rem; }
.mt-auto { margin-top: auto; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-10 { margin-top: 2.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }
.mx-auto { margin: 0 auto; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pr-3 { padding-right: 0.75rem; }
.pl-3 { padding-left: 0.75rem; }
.pl-10 { padding-left: 2.5rem; }
.overflow-hidden { overflow: hidden; }

/* 边框和圆角 */
.border { border-width: 1px; border-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-l-4 { border-left-width: 4px; border-left-style: solid; }
.border-gray-300 { border-color: #d1d5db; }
.border-indigo-100 { border-color: #e0e7ff; }
.border-red-500 { border-color: #ef4444; }
.border-indigo-500 { border-color: #6366f1; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-r { border-top-right-radius: 0.375rem; border-bottom-right-radius: 0.375rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* 阴影 */
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }

/* 文字样式 */
.text-center { text-align: center; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.leading-relaxed { line-height: 1.625; }
.text-white { color: #ffffff; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-red-500 { color: #ef4444; }
.text-red-700 { color: #b91c1c; }
.text-indigo-600 { color: #4f46e5; }
.text-indigo-700 { color: #4338ca; }
.text-indigo-800 { color: #3730a3; }
.text-indigo-100 { color: #e0e7ff; }

/* 交互状态 */
.transition-colors { transition-property: color, background-color, border-color; transition-duration: 150ms; }
.transition-all { transition-property: all; transition-duration: 200ms; }
.hover\:text-red-700:hover { color: #b91c1c; }
.hover\:text-indigo-500:hover { color: #6366f1; }
.hover\:bg-indigo-700:hover { background-color: #4338ca; }
.hover\:-translate-y-0\.5:hover { transform: translateY(-0.125rem); }
.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5); }
.focus\:ring-indigo-500:focus { --tw-ring-color: #6366f1; }
.focus\:ring-offset-2:focus { box-shadow: 0 0 0 2px white, 0 0 0 4px #6366f1; }
.focus\:border-indigo-500:focus { border-color: #6366f1; }

/* 表单元素 */
.block { display: block; }
.inline-flex { display: inline-flex; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-y-0 { top: 0; bottom: 0;}
.left-0 { left: 0; }
.right-0 { right: 0; }
.pointer-events-none { pointer-events: none; }
input[type="text"],
input[type="password"] {
    appearance: none;
    background-color: #fff;
}
input:focus {
    outline: none;
}
button {
    cursor: pointer;
    border: none;
}
a {
    text-decoration: none;
}

/* 响应式 */
@media (min-width: 640px) {
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
    .sm\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
}
@media (min-width: 1024px) {
    .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}
@media (max-width: 640px) {
    .p-8 { padding: 1.5rem; }
    .text-3xl { font-size: 1.5rem; }
}

/* 额外优化 */
.flex-shrink-0 { flex-shrink: 0; }
.inline { display: inline; }
.opacity-20 { opacity: 0.2; }
.bg-opacity-20 { --tw-bg-opacity: 0.2; background-color: rgba(255,255,255,0.2); }
.border-transparent { border-color: transparent; }

/* 表格样式 */
        /*table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 13px; }
        th, td { padding: 10px 8px; text-align: center; border: 1px solid #eee; }
        th { background: #07c160; color: #fff; font-weight: 500; white-space: nowrap; }
        tr:nth-child(even) { background: #fafafa; }
        tr:hover { background: #f0f9f2; }
        img { max-width: 50px; max-height: 50px; border-radius: 4px; object-fit: cover; }
        .price { color: #e64340; font-weight: 600; }
        .empty-tip { text-align: center; color: #999; padding: 40px; }
        .tip { font-size: 12px; color: #999; margin-top: 5px; }*/
        
      /* ========== 缩略图样式 ========== */
.thumb-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: zoom-in;
    transition: transform 0.2s;
    border: 1px solid #eee;
}
.thumb-img:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ========== 弹窗遮罩 ========== */
.lb-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9); /* 加深遮罩更突出图片 */
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.lb-overlay.active {
    display: flex;
    opacity: 1;
}
/* ========== 大图容器 ========== */
.lb-container {
    position: relative;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* 给透明PNG加一个浅白格子衬底，既不破坏透明效果又能看清图片 */
    background-image: linear-gradient(45deg, #eee 25%, transparent 25%),
                      linear-gradient(-45deg, #eee 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #eee 75%),
                      linear-gradient(-45deg, transparent 75%, #eee 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #fff;
    border-radius: 4px;
    padding: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.lb-img {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    min-width: 200px;      /* 小图不会缩成一团 */
    min-height: 150px;
    object-fit: contain;   /* 保持比例完整显示 */
    border-radius: 2px;
    transform: scale(0.85);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* 带弹性的放大动画 */
    cursor: zoom-out;
    user-select: none;
}
.lb-overlay.active .lb-img {
    transform: scale(1);
}
/* ========== 加载提示 ========== */
.lb-loading {
    position: absolute;
    color: #333;
    font-size: 14px;
    display: none;
    background: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 2;
}
.lb-container.loading .lb-loading { display: block; }
.lb-container.loading .lb-img { opacity: 0; } /* 修复：loading时才透明，默认不透明 */
.lb-img { opacity: 1; } /* 默认不透明，防止残留状态 */

/* ========== 按钮通用样式 ========== */
.lb-close, .lb-prev, .lb-next {
    position: absolute;
    background: rgba(255,255,255,0.9);
    color: #333;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 22px;
    line-height: 44px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 3;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover {
    background: #fff;
    transform: scale(1.1);
}
.lb-close {
    top: 20px;
    right: 20px;
    font-size: 28px;
}
.lb-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}
.lb-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}
.lb-prev:hover, .lb-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .lb-close { top: 15px; right: 15px; width: 36px; height: 36px; line-height: 36px; font-size: 22px; }
    .lb-prev { left: 10px; width: 36px; height: 36px; line-height: 36px; font-size: 18px; }
    .lb-next { right: 10px; width: 36px; height: 36px; line-height: 36px; font-size: 18px; }
    .lb-img { max-width: 95vw; max-height: 80vh; min-width: 150px; min-height: 100px; }
    .lb-container { max-width: 95vw; max-height: 85vh; }
}

/* ========== 手机端适配（768px 以下生效） ========== */
@media (max-width: 768px) {
    /* ---------- 基础 ---------- */
    body { font-size: 14px; -webkit-text-size-adjust: 100%; }

    /* ---------- 导航栏 ---------- */
    nav .max-w-7xl { padding: 0 12px; }
    nav .flex.justify-between { height: 52px; }            /* 收窄导航高度 */
    nav .font-bold.text-xl { font-size: 16px; }
    nav svg[viewBox="0 0 24 24"]:first-of-type { width: 22px; height: 22px; margin-right: 6px; }
    nav .text-gray-600.text-sm { display: none; }          /* 手机上隐藏"欢迎, xxx"省空间 */
    nav .space-x-4 > * + * { margin-left: 8px !important; }
    nav a.text-red-500 { font-size: 13px; padding: 6px 0; }
    nav a.text-red-500 svg { width: 14px; height: 14px; }

    /* ---------- 主内容容器 ---------- */
    main { padding: 10px; }
    main .container { padding: 0; }
    main .bg-white.rounded-lg {
        padding: 14px;
        margin-top: 8px;
        border-left-width: 3px;
        border-radius: 6px;
    }

    /* ---------- 标题区 ---------- */
    h1.text-3xl { font-size: 20px; margin-bottom: 8px; line-height: 1.3; }
    p.text-gray-600.mb-6 { font-size: 13px; margin-bottom: 14px; line-height: 1.6; }

    /* ---------- 顶部操作栏（标题 + 添加按钮） ---------- */
    .header {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 12px;
        margin-top: 14px;
    }
    .header h1, .header #toadd, .header #toaddnew {
        font-size: 16px !important;
        margin: 0;
    }
    .header .btn, .header .btn-primary {
        width: 100%;
        text-align: center;
        padding: 10px 12px;
        font-size: 14px;
        border-radius: 6px;
    }

    /* ---------- 提示条 ---------- */
    .alert.alert-success {
        padding: 8px 12px;
        font-size: 13px;
        margin: 8px 0;
        border-radius: 4px;
    }

    /* ---------- 表格容器：横向滚动 ---------- */
    .table-responsive {
        margin: 0 -4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;    
        border-radius: 4px;
    }
    table, table.table {
        font-size: 12px;
        margin-top: 8px;
        width: max-content;        
        min-width: 100%;
    }
    table th, table td {
        padding: 7px 6px;
        font-size: 12px;
        white-space: nowrap;
    }
    table th { font-size: 12px; padding: 8px 6px; text-align: center; }
    table img { max-width: 40px; max-height: 40px; border-radius: 3px; }

    /* 操作列的按钮/链接增大点击区域 */
    table td a, table td button {
        padding: 4px 8px;
        font-size: 12px;
        min-height: 28px;
        display: inline-block;
        line-height: 20px;
        margin: 1px 0;
    }

    /* 单选按钮加大点击区域 */
    table input[type="radio"] {
        width: 18px;
        height: 18px;
    }

    /* 缩略图 */
    .thumb-img { width: 50px; height: 50px; }

    /* ---------- 会话信息卡片 ---------- */
    .bg-indigo-50 {
        padding: 12px;
        margin-top: 14px;
        border-radius: 6px;
    }
    .bg-indigo-50 h3 { font-size: 14px; margin-bottom: 6px; }
    .bg-indigo-50 ul li {
        font-size: 12px;
        line-height: 1.7;
        word-break: break-all;
    }

    /* ---------- 页脚 ---------- */
    footer .max-w-7xl { padding: 14px 12px; }
    footer p { font-size: 12px; }

    /* ---------- 图片弹窗 ---------- */
    .lb-container { padding: 2px; max-width: 96vw; max-height: 82vh; }
    .lb-img {
        min-width: unset !important;
        min-height: unset !important;
        max-width: 94vw !important;
        max-height: 75vh !important;
    }
    .lb-close { top: 10px; right: 10px; width: 36px; height: 36px; line-height: 36px; font-size: 22px; }
    .lb-prev { left: 6px; width: 32px; height: 32px; line-height: 32px; font-size: 16px; }
    .lb-next { right: 6px; width: 32px; height: 32px; line-height: 32px; font-size: 16px; }

    /* ---------- 空数据 / 加载提示 ---------- */
    .empty-tip, td.text-center[colspan] { padding: 24px 12px; font-size: 13px; }
    .tip { font-size: 11px; }
}

/* 超小屏（<380px）进一步收窄 */
@media (max-width: 380px) {
    h1.text-3xl { font-size: 18px; }
    main .bg-white.rounded-lg { padding: 12px 10px; }
    table th, table td { padding: 6px 5px; font-size: 11px; }
}

/* 弹出时禁止页面滚动 */
body.lb-open { overflow: hidden; }

