/* ==========================================================================
   Carman 车辆数据处理中心 - 史诗级移动端优化 CSS
   断点体系: XS(<375) | SM(375-413) | MD(414-767) | LG(768-1023) | XL(1024+)
   间距基准: 4px 体系 | 触控标准: ≥48dp | 动效标准: 200-350ms
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    /* === 色彩体系 === */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #f8fafc;
    --secondary-hover: #e2e8f0;
    --accent-color: #8b5cf6;
    --accent-hover: #7c3aed;
    --danger-color: #ef4444;

    --bg-body: #f1f5f9;
    --bg-card: #ffffff;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #cbd5e1;

    /* === 圆角 === */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* === 阴影 === */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* === 4px基准间距系统 === */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* === 字体层级 === */
    --font-h1: 1.25rem;
    --font-h2: 1.0625rem;
    --font-h3: 0.9375rem;
    --font-body: 0.875rem;
    --font-caption: 0.75rem;
    --font-price: 1.125rem;

    /* === 动效体系 === */
    --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);        /* 页面转场/弹窗进入 */
    --ease-in-expo: cubic-bezier(0.4, 0, 1, 1);              /* 弹窗退出 */
    --ease-standard: cubic-bezier(0, 0, 0.2, 1);              /* 元素出现/隐出 */
    --ease-emphasized: cubic-bezier(0.4, 0, 0.2, 1);          /* 微交互反馈 */
    
    --duration-page-in: 250ms;
    --duration-page-out: 200ms;
    --duration-element: 200ms;
    --duration-micro: 120ms;
    --duration-toast: 300ms;
    --duration-stagger: 40ms;

    /* === 安全区 (iPhone X+ 刘海/灵动岛适配) === */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);

    /* === 触控标准 === */
    --touch-target-min: 48px;
    --touch-spacing-min: 8px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: auto;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* ==========================================================================
   Keyframes - 标准化动效
   ========================================================================== */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    0%   { opacity: 0; transform: scale(0.92); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse-border {
    0%   { border-color: rgba(139, 92, 246, 0.4); }
    50%  { border-color: rgba(139, 92, 246, 1); }
    100% { border-color: rgba(139, 92, 246, 0.4); }
}

@keyframes shrinkOut {
    0%   { opacity: 1; transform: scaleY(1); max-height: 200px; }
    100% { opacity: 0; transform: scaleY(0); max-height: 0; margin: 0; padding: 0; border: none; }
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-16px) scale(0.95); }
}

@keyframes bottomSheetUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes bottomSheetDown {
    from { transform: translateY(0); }
    to   { transform: translateY(100%); }
}

/* Reduced Motion - 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}

/* ==========================================================================
   Switch UI - 触控区域增强至48dp
   ========================================================================== */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    cursor: pointer;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.slider {
    position: relative;
    width: 44px;
    height: 26px;
    background-color: #ccc;
    transition: background-color 200ms var(--ease-standard);
    border-radius: 26px;
    will-change: background-color;
}

.slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: transform 200ms var(--ease-standard);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    will-change: transform;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus-visible + .slider {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

input:checked + .slider::before {
    transform: translateX(18px);
}

/* ==========================================================================
   Alert Modal
   ========================================================================== */
.alert-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: -webkit-fill-available;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-page-in) var(--ease-out-expo);
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
}

.alert-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.alert-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    width: calc(100% - var(--space-xl) * 2);
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    transform: scale(0.92);
    transition: transform var(--duration-page-in) var(--ease-out-expo);
    text-align: center;
}

.alert-modal.show .alert-modal-content {
    transform: scale(1);
}

.alert-modal-text {
    font-size: var(--font-body);
    color: var(--text-main);
    margin-bottom: 20px;
    white-space: pre-wrap;
    line-height: 1.6;
}

.alert-modal-btn {
    width: 100%;
    padding: 12px;
    min-height: var(--touch-target-min);
}

/* ==========================================================================
   Layout - 响应式流体布局
   ========================================================================== */
.app-container {
    max-width: 100%;
    margin: 0;
    padding: 0 var(--space-lg);
    padding-top: 0;
    animation: slideUpFade 300ms var(--ease-out-expo);
    padding-bottom: calc(var(--safe-area-bottom) + 64px); /* 为底部Tab Bar留空间 */
}

.app-main {
    max-width: 900px;
    margin: 0 auto;
}

/* Header - Glassmorphism */
.app-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-bottom: var(--space-lg);
    padding-top: var(--safe-area-top);
}

.app-header-content {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 14px var(--space-lg);
    gap: var(--space-sm);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.brand h1 {
    font-size: var(--font-h1);
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.header-actions .btn {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 6px 10px;
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
}

.admin-entry-label { margin-left: 4px; }

/* 余额徽章 */
.balance-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.08);
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    cursor: default;
    transition: all 0.2s;
    white-space: nowrap;
}
.balance-badge:hover {
    background: rgba(15, 23, 42, 0.07);
}
.balance-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #94a3b8;
}
.balance-dot.balance-ok {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}
.balance-dot.balance-low {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}
.balance-dot.balance-error {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}
.balance-dot.balance-loading {
    background: #6366f1;
    animation: balancePulse 1s ease-in-out infinite;
}
@keyframes balancePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.balance-text {
    letter-spacing: 0.01em;
}
.balance-refresh-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}
.balance-refresh-btn:hover {
    color: #6366f1;
}

.login-status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 12px 14px;
    margin-bottom: var(--space-md);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(37, 99, 235, 0.14);
    color: var(--text-main);
}

.auth-modal-content {
    max-width: 420px;
}

.auth-modal-subtitle {
    color: var(--text-muted);
    font-size: var(--font-body);
    margin: -8px 0 20px;
    line-height: 1.6;
}

/* ==========================================================================
   Locked State (未登录状态)
   ========================================================================== */
.app-main-locked .form-control {
    background-color: #f8fafc;
    color: #94a3b8;
    pointer-events: none;
    border-color: #e2e8f0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2394a3b8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>');
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}

.app-main-locked .btn:not(#btn-open-login) {
    background-color: #f1f5f9;
    color: #94a3b8;
    pointer-events: none;
    border-color: #e2e8f0;
    box-shadow: none;
}

.app-main-locked .form-group label {
    color: #94a3b8;
}

.app-main-locked .tag-btn {
    background-color: #f1f5f9;
    color: #94a3b8;
    pointer-events: none;
    border-color: #e2e8f0;
    position: relative;
    padding-right: 28px;
}

.app-main-locked .tag-btn::after {
    content: "";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2394a3b8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>');
    background-repeat: no-repeat;
    background-size: contain;
}

/* ==========================================================================
   UI Icons
   ========================================================================== */
.ui-icon {
    width: 1.2em;
    height: 1.2em;
    vertical-align: -0.2em;
    display: inline-block;
    pointer-events: none;
}

.logo-icon img {
    width: 1.8rem;
    height: 1.8rem;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    transition: box-shadow 200ms var(--ease-standard);
    contain: layout style;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.card-header h3 {
    font-size: var(--font-h2);
    font-weight: 600;
    margin-bottom: 0;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: var(--font-body);
    font-weight: 500;
    margin-bottom: var(--space-sm);
    color: var(--text-muted);
    user-select: none;
}

.form-control {
    width: 100%;
    padding: 12px var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-body);
    font-family: inherit;
    background-color: #fff;
    transition: border-color 120ms var(--ease-standard), box-shadow 120ms var(--ease-standard);
    outline: none;
    color: var(--text-main);
    min-height: var(--touch-target-min);
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control.input-error {
    background-color: #fee2e2;
    border-color: var(--danger-color);
}

.form-control.input-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

textarea.form-control {
    min-height: 180px;
    resize: none;
    max-height: 60vh;
    line-height: 1.5;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* ==========================================================================
   Buttons - 触控热区 ≥48dp
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 20px;
    font-size: var(--font-body);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 120ms var(--ease-standard), 
                box-shadow 120ms var(--ease-standard),
                background-color 120ms var(--ease-standard);
    outline: none;
    text-decoration: none;
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* 小按钮保留最小触控区域 */
.btn-sm {
    padding: 8px 14px;
    font-size: 0.8rem;
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-hover);
}

.btn-accent {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

.btn-accent:hover:not(:disabled) {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--secondary-color);
    border-color: #94a3b8;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    min-height: 52px;
}

/* 危险按钮增强触控 */
.btn-danger {
    background: transparent;
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-color);
    color: white;
}

/* ==========================================================================
   Action Area Grid
   ========================================================================== */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: 20px;
}

/* ==========================================================================
   Image Preview Grid - 流体自适应
   ========================================================================== */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: var(--space-sm);
    min-height: 120px;
    background: var(--secondary-color);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: var(--space-sm);
    padding: var(--space-lg) 0;
}

.empty-state .icon {
    font-size: 2rem;
    opacity: 0.5;
}

/* 预览图项 - 使用aspect-ratio自适应 */
.preview-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    animation: popIn 200ms var(--ease-standard);
    background: #fff;
    will-change: transform;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 200ms var(--ease-standard);
}

/* 长按模式：移动端hover降级 */
@media (hover: hover) and (pointer: fine) {
    .preview-item:hover img {
        transform: scale(1.05);
    }
}

/* 预览按钮 - 48dp触控区域 */
.btn-preview-img {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    background: rgba(0, 0, 0, 0.55);
    color: white;
    border: none;
    border-radius: 50%;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
    transition: background 120ms var(--ease-standard), transform 120ms var(--ease-standard);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    -webkit-tap-highlight-color: transparent;
}

.btn-preview-img:active {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(0.9);
}

/* 删除按钮 - 48dp触控区域 */
.btn-delete-img {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: rgba(239, 68, 68, 0.85);
    color: white;
    border: none;
    border-radius: 50%;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
    transition: background 120ms var(--ease-standard), transform 120ms var(--ease-standard);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    -webkit-tap-highlight-color: transparent;
}

.btn-delete-img:active {
    background: var(--danger-color);
    transform: scale(0.9);
}

/* ==========================================================================
   History Cards & Modals
   ========================================================================== */
.history-action-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.history-fullinfo-modal-content {
    max-width: 600px;
}

.history-fullinfo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 20px;
}

.history-fullinfo-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px var(--space-md);
}

.history-fullinfo-card h3 {
    margin: 0 0 10px;
    font-size: var(--font-body);
    color: #475569;
}

.history-fullinfo-item {
    color: var(--text-main);
    font-size: var(--font-body);
    line-height: 1.7;
}

.history-fullinfo-item strong {
    color: #334155;
}

.history-fullinfo-text {
    background: var(--text-main);
    color: #e2e8f0;
    border-radius: 12px;
    padding: var(--space-md);
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 280px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.history-thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-md);
}

.history-thumb-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #e2e8f0;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    border: 1px solid #dbe2ea;
    transition: transform 150ms var(--ease-standard), box-shadow 150ms var(--ease-standard);
    will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
    .history-thumb-item:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }
}

.history-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.history-thumb-tip {
    position: absolute;
    left: var(--space-sm);
    right: var(--space-sm);
    bottom: var(--space-sm);
    padding: 4px var(--space-sm);
    border-radius: 999px;
    font-size: 11px;
    text-align: center;
    color: #fff;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ==========================================================================
   Image Status Overlays
   ========================================================================== */
.preview-item.status-nameplate { border: 3px solid #3b82f6; }
.preview-item.status-nameplate::after {
    content: "车辆铭牌";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(59, 130, 246, 0.9);
    color: white;
    font-size: 10px;
    text-align: center;
    padding: 3px 0;
    z-index: 5;
}

.preview-item.status-dealer { border: 3px solid #ef4444; }
.preview-item.status-dealer::after {
    content: "存在经销商信息";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    font-size: 10px;
    text-align: center;
    padding: 3px 0;
    z-index: 5;
}

.preview-item.status-valid { border: 3px solid #10b981; }
.preview-item.status-valid::after {
    content: "合格车辆照片";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(16, 185, 129, 0.9);
    color: white;
    font-size: 10px;
    text-align: center;
    padding: 3px 0;
    z-index: 5;
}

.preview-item.status-unknown { border: 3px solid #9ca3af; }
.preview-item.status-unknown::after {
    content: "疑似无关信息";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(156, 163, 175, 0.9);
    color: white;
    font-size: 10px;
    text-align: center;
    padding: 3px 0;
    z-index: 5;
}

.preview-item.status-processing::after {
    content: "AI识别中...";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 10px;
    text-align: center;
    padding: 3px 0;
    z-index: 5;
}

.preview-item.status-generating {
    border: 3px solid #8b5cf6;
    animation: pulse-border 1.5s infinite;
}
.preview-item.status-generating img {
    opacity: 0.6;
    filter: grayscale(30%) blur(1px);
}
.preview-item.status-generating::after {
    content: "豆包生图中...";
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(139, 92, 246, 0.9);
    color: white;
    font-size: 10px;
    text-align: center;
    padding: 3px 0;
    z-index: 5;
}

/* ==========================================================================
   Progress Bar - transform: scaleX 替代 width（GPU加速）
   ========================================================================== */
.progress-container {
    width: 100%;
    height: 8px;
    background-color: var(--secondary-hover);
    border-radius: 4px;
    margin-top: var(--space-md);
    overflow: hidden;
    display: none;
}

.progress-container.active {
    display: block;
}

.progress-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 300ms var(--ease-standard);
    will-change: transform;
    border-radius: 4px;
}

.progress-text {
    font-size: var(--font-caption);
    color: var(--text-muted);
    text-align: right;
    margin-top: var(--space-xs);
    display: none;
}

.progress-text.active {
    display: block;
}

/* ==========================================================================
   Modal - 居中弹窗
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: -webkit-fill-available;
    background-color: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-page-in) var(--ease-out-expo),
                visibility var(--duration-page-in) var(--ease-out-expo);
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    width: calc(100% - var(--space-xl) * 2);
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    position: relative;
    max-height: calc(90vh - var(--safe-area-top) - var(--safe-area-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-shadow: var(--shadow-xl);
    transform: translateY(12px) scale(0.95);
    transition: transform var(--duration-page-in) var(--ease-out-expo);
    will-change: transform;
}

.modal:not(.hidden) .modal-content {
    transform: translateY(0) scale(1);
}

.modal h2 {
    font-size: var(--font-h2);
    margin-bottom: var(--space-lg);
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

/* 关闭按钮 - 48dp触控区域 */
.close-btn {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 120ms var(--ease-standard);
    border-radius: 50%;
    border: none;
    background: transparent;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
}

.close-btn:active {
    color: var(--text-main);
    background: rgba(0,0,0,0.05);
}

/* ==========================================================================
   Bottom Sheet - 底部弹出面板
   ========================================================================== */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: -webkit-fill-available;
    background: rgba(15, 23, 42, 0.4);
    z-index: 2100;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-page-in) var(--ease-out-expo),
                visibility var(--duration-page-in) var(--ease-out-expo);
}

.bottom-sheet-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 2101;
    padding: var(--space-lg);
    padding-bottom: calc(var(--space-lg) + var(--safe-area-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    transform: translateY(100%);
    transition: transform var(--duration-page-in) var(--ease-out-expo);
    will-change: transform;
}

.bottom-sheet-overlay:not(.hidden) .bottom-sheet {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto var(--space-md);
    opacity: 0.6;
}

.bottom-sheet h2 {
    font-size: var(--font-h2);
    margin-bottom: var(--space-lg);
    color: var(--text-main);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* ==========================================================================
   Contact Items
   ========================================================================== */
.contact-item {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    animation: fadeIn 200ms var(--ease-standard);
}

.contact-item .form-control {
    margin-bottom: 0;
}

.btn-remove-contact {
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    color: var(--danger-color);
    border-radius: var(--radius-sm);
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    cursor: pointer;
    transition: background 120ms var(--ease-standard);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.btn-remove-contact:active {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* ==========================================================================
   Preset List
   ========================================================================== */
.preset-list-container {
    margin-top: var(--space-xl);
}

.preset-list-container h3 {
    font-size: var(--font-h3);
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

#preset-ul {
    list-style: none;
}

#preset-ul li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
    transition: border-color 120ms var(--ease-standard);
}

#preset-ul li:active {
    border-color: var(--primary-color);
}

.preset-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.preset-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: var(--font-body);
}

.preset-tags {
    font-size: var(--font-caption);
    color: var(--text-muted);
}

.btn-del-preset {
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    background: transparent;
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--font-caption);
    cursor: pointer;
    transition: background 120ms var(--ease-standard), color 120ms var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
}

.btn-del-preset:active {
    background: var(--danger-color);
    color: white;
}

.btn-del-tag {
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    background: transparent;
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--font-caption);
    cursor: pointer;
    transition: background 120ms var(--ease-standard), color 120ms var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
}

.btn-del-tag:active {
    background: var(--danger-color);
    color: white;
}

/* ==========================================================================
   Tag Buttons - 触控增强
   ========================================================================== */
.tag-btn {
    padding: 8px 16px;
    background-color: var(--secondary-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: var(--font-caption);
    cursor: pointer;
    transition: transform 120ms var(--ease-standard),
                background-color 120ms var(--ease-standard),
                border-color 120ms var(--ease-standard);
    user-select: none;
    min-height: var(--touch-target-min);
    display: inline-flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

.tag-btn:active {
    background-color: #e2e8f0;
    transform: scale(0.96);
}

.tag-btn.active {
    background-color: #e0f2fe;
    color: #0369a1;
    border-color: #7dd3fc;
}

/* ==========================================================================
   Hidden Utility
   ========================================================================== */
.hidden {
    display: none !important;
}

/* ==========================================================================
   Admin Dashboard
   ========================================================================== */
.admin-animate-in {
    animation: slideUpFade 300ms var(--ease-out-expo) forwards;
    opacity: 0;
}
.admin-animate-in:nth-child(1) { animation-delay: 50ms; }
.admin-animate-in:nth-child(2) { animation-delay: 100ms; }
.admin-animate-in:nth-child(3) { animation-delay: 150ms; }

.admin-header {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* Stat Cards */
.stat-card {
    transition: transform 200ms var(--ease-standard), box-shadow 200ms var(--ease-standard);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
    .stat-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 100px;
    height: 100px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.05;
    pointer-events: none;
}

.stat-card-ai::after { background-image: url('../images/icons/icon-magic.svg'); }
.stat-card-up::after { background-image: url('../images/icons/icon-camera.svg'); }
.stat-card-ds::after { background-image: url('../images/icons/icon-save.svg'); }
.stat-card-qw::after { background-image: url('../images/icons/icon-preview.svg'); }

/* ==========================================================================
   Segmented Control - 触控增强
   ========================================================================== */
.segmented-control {
    display: flex;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 8px;
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 20px auto;
    user-select: none;
}

.segmented-btn {
    flex: 1;
    text-align: center;
    padding: 10px var(--space-md);
    border-radius: 6px;
    font-size: var(--font-body);
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: color 200ms var(--ease-standard);
    z-index: 2;
    background: transparent;
    border: none;
    min-height: var(--touch-target-min);
    -webkit-tap-highlight-color: transparent;
}

.segmented-btn.active {
    color: var(--text-main);
}

.segmented-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc((100% - 8px) / 3);
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 250ms var(--ease-out-expo);
    z-index: 1;
    will-change: transform;
}

/* ==========================================================================
   Admin Image Grid
   ========================================================================== */
.admin-image-item {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0;
    background: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 200ms var(--ease-standard), box-shadow 200ms var(--ease-standard);
    aspect-ratio: 1 / 1;
    will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
    .admin-image-item:hover {
        transform: scale(1.02);
        box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    }
    .admin-image-item:hover img {
        transform: scale(1.05);
    }
}

.admin-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 200ms var(--ease-standard);
}

.admin-image-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 200ms var(--ease-standard);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    pointer-events: none;
}

.admin-image-item.selected .admin-image-overlay {
    opacity: 1;
    pointer-events: auto;
}

.admin-image-item.selected {
    border-color: var(--primary-color);
}

/* 管理员复选框 - 48dp触控区域 */
.admin-image-cb {
    width: 22px;
    height: 22px;
    cursor: pointer;
    margin: 0;
    accent-color: var(--primary-color);
}

/* 扩大复选框点击区域 */
.admin-image-overlay label,
.admin-image-overlay .admin-image-cb-wrapper {
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    display: inline-flex;
    align-items: center;
}

/* ==========================================================================
   Floating Action Bar - 安全区适配
   ========================================================================== */
.floating-action-bar {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: var(--space-md) var(--space-lg);
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 1100;
    transition: bottom 300ms var(--ease-out-expo);
    bottom: -100px;
}

.floating-action-bar.visible {
    bottom: calc(24px + var(--safe-area-bottom));
}

.admin-user-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.admin-user-hint {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: var(--font-body);
}

.admin-user-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: var(--space-lg);
}

.admin-user-form-card,
.admin-user-list-card {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.admin-user-form-card h4,
.admin-user-list-card h4 {
    margin-bottom: var(--space-md);
    font-size: var(--font-h3);
    color: var(--text-main);
}

.admin-user-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.admin-user-count {
    font-size: var(--font-caption);
    color: var(--text-muted);
}

.admin-users-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.admin-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
}

.admin-user-meta {
    min-width: 0;
}

.admin-user-name {
    font-size: var(--font-body);
    font-weight: 600;
    color: var(--text-main);
}

.admin-user-desc {
    margin-top: 4px;
    font-size: var(--font-caption);
    color: var(--text-muted);
    word-break: break-word;
}

/* ==========================================================================
   Table Enhancements
   ========================================================================== */
.admin-table-row {
    transition: background-color 150ms var(--ease-standard);
    position: relative;
}

.admin-table-row:nth-child(even) {
    background-color: #f8fafc;
}

.admin-table-row:active {
    background-color: #e2e8f0;
}

.admin-table-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--primary-color);
    transform: scaleY(0);
    transition: transform 150ms var(--ease-standard);
}

@media (hover: hover) and (pointer: fine) {
    .admin-table-row:hover {
        background-color: #e2e8f0;
    }
    .admin-table-row:hover::before {
        transform: scaleY(1);
    }
}

/* ==========================================================================
   Toast Notification - 序列化入场 + 安全区
   ========================================================================== */
.toast-container {
    position: fixed;
    top: calc(var(--safe-area-top) + 12px);
    right: max(var(--safe-area-right), 16px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
    max-width: calc(100vw - 32px);
}

.toast {
    background: white;
    color: var(--text-main);
    padding: var(--space-md);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    border-left: 4px solid var(--primary-color);
    pointer-events: auto;
    font-size: var(--font-body);
    min-height: var(--touch-target-min);
    will-change: transform, opacity;
    animation: toastSlideIn var(--duration-toast) var(--ease-out-expo) forwards;
}

.toast.toast-success { border-left-color: #10b981; }
.toast.toast-error { border-left-color: #ef4444; }

.toast.hide {
    animation: toastSlideOut var(--duration-page-out) var(--ease-in-expo) forwards;
}

/* ==========================================================================
   Custom Confirm Modal
   ========================================================================== */
.custom-confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-page-in) var(--ease-out-expo),
                visibility var(--duration-page-in) var(--ease-out-expo);
    padding: var(--space-lg);
}

.custom-confirm-overlay.show {
    opacity: 1;
    visibility: visible;
}

.custom-confirm-box {
    background: white;
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-xl);
    transform: scale(0.92);
    transition: transform var(--duration-page-in) var(--ease-out-expo);
}

.custom-confirm-overlay.show .custom-confirm-box {
    transform: scale(1);
}

.custom-confirm-title {
    font-size: var(--font-h2);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-main);
}

.custom-confirm-desc {
    font-size: var(--font-body);
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

.custom-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}

/* ==========================================================================
   Delete Animation - GPU加速(move to max-height)
   ========================================================================== */
.item-deleting {
    animation: shrinkOut 300ms var(--ease-in-expo) forwards !important;
    overflow: hidden !important;
}

/* ==========================================================================
   Bottom Tab Bar - iOS风格
   ========================================================================== */
.bottom-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 500;
}

.bottom-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    transition: color 150ms var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.bottom-tab-item .tab-icon {
    font-size: 22px;
    line-height: 1;
}

.bottom-tab-item.active {
    color: var(--primary-color);
}

/* ==========================================================================
   Admin Bottom Bar - 管理端底部日志任务栏
   ========================================================================== */
.admin-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1600;
}

.admin-bottom-bar-title {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.admin-bottom-bar-actions {
    display: flex;
    gap: 12px;
}

/* ==========================================================================
   Admin Log Modal - 详细诊断日志弹窗
   ========================================================================== */
.admin-log-modal-content {
    max-width: 880px;
    display: flex;
    flex-direction: column;
    max-height: 88vh;
}

.admin-log-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.admin-log-status {
    font-size: 13px;
    color: #64748b;
}

.admin-log-toolbar-actions {
    display: flex;
    gap: 8px;
}

.admin-log-body {
    flex: 1;
    min-height: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #0f172a;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.admin-log-pre {
    flex: 1;
    min-height: 260px;
    max-height: 56vh;
    margin: 0;
    padding: 16px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #0f172a;
    color: #d1fae5;
    font-family: Consolas, "Courier New", Menlo, monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    user-select: text;
    -webkit-user-select: text;
}

.admin-log-pre.log-loading {
    color: #94a3b8;
}

.admin-log-pre.log-error {
    color: #fca5a5;
}

.admin-log-actions {
    margin-top: 12px;
}

/* ==========================================================================
   Floating Action Button (FAB) - 一键智能处理
   ========================================================================== */
.fab-main {
    position: fixed;
    bottom: calc(72px + var(--safe-area-bottom));
    right: max(var(--safe-area-right), var(--space-lg));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    cursor: pointer;
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    transition: transform 150ms var(--ease-standard), box-shadow 150ms var(--ease-standard);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    will-change: transform;
}

.fab-main:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.fab-main:disabled {
    opacity: 0.5;
    transform: none;
    cursor: not-allowed;
}

.fab-main .fab-icon {
    font-size: 22px;
    line-height: 1;
}

/* ==========================================================================
   Skeleton Screen - 骨架屏
   ========================================================================== */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--space-sm);
    width: 80%;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-image {
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   Scroll Container Unified
   ========================================================================== */
.scroll-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Table horizontal scroll for mobile */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 4px, black calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 4px, black calc(100% - 16px), transparent 100%);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    padding-bottom: calc(var(--space-lg) + var(--space-md));
    font-size: var(--font-caption);
    color: #94a3b8;
    margin-top: var(--space-sm);
}

/* ==========================================================================
   响应式断点体系
   ========================================================================== */

/* XS: iPhone SE, 小屏安卓 (<375px) */
@media (max-width: 374px) {
    .app-container {
        padding: 0 10px;
    }

    .app-header-content {
        padding: 8px 10px;
        gap: 6px;
    }

    .brand {
        gap: 4px;
    }

    .brand h1 {
        font-size: 0.9rem;
    }

    .logo-icon img {
        width: 1.2rem;
        height: 1.2rem;
    }

    .header-actions {
        gap: 4px;
    }

    .header-actions .btn {
        padding: 5px 8px;
        font-size: 0.7rem;
        min-height: 36px;
        min-width: 36px;
    }

    .login-status-banner {
        flex-direction: column;
        align-items: stretch;
    }

    .balance-badge {
        padding: 2px 8px;
        font-size: 0.7rem;
    }

    .balance-refresh-btn {
        font-size: 0.75rem;
    }

    .card {
        padding: 12px;
        margin-bottom: 12px;
    }

    .card-header {
        margin-bottom: 10px;
    }

    .card-header h3 {
        font-size: 0.9rem;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
        padding: 8px;
        gap: 6px;
    }

    .action-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .history-thumb-grid {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    }

    textarea.form-control {
        min-height: 130px;
    }

    .modal-content {
        padding: var(--space-md);
        width: calc(100% - 20px);
    }

    .admin-user-layout {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .admin-user-item,
    .admin-user-list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .bottom-sheet {
        padding: var(--space-md);
    }

    .fab-main {
        width: 48px;
        height: 48px;
        right: 10px;
        font-size: 10px;
    }

    .fab-main .fab-icon {
        font-size: 18px;
    }
}

/* SM: iPhone 6/7/8/X/11/12/13/14 Pro (375-413px) */
@media (min-width: 375px) and (max-width: 413px) {
    .app-container {
        padding: 0 12px;
    }

    .app-header-content {
        padding: 10px 12px;
        gap: 8px;
    }

    .card {
        padding: 14px;
        margin-bottom: 14px;
    }

    .card-header {
        margin-bottom: 10px;
    }

    .card-header h3 {
        font-size: 0.95rem;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
        padding: 10px;
        gap: 8px;
    }

    .action-grid {
        gap: var(--space-sm);
    }

    .history-thumb-grid {
        grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    }

    textarea.form-control {
        min-height: 140px;
    }

    .modal-content {
        padding: 20px;
        width: calc(100% - 24px);
    }

    .login-status-banner {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-user-layout {
        grid-template-columns: 1fr;
    }
}

/* MD: iPhone Plus/Max, 大屏安卓 (414-767px) */
@media (min-width: 414px) and (max-width: 767px) {
    .app-container {
        padding: 0 16px;
    }

    .card {
        padding: var(--space-md);
        margin-bottom: var(--space-md);
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        padding: 12px;
        gap: 10px;
    }

    .history-thumb-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .action-grid {
        grid-template-columns: 1fr 1fr;
    }

    .history-fullinfo-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-user-layout {
        grid-template-columns: 1fr;
    }
}

/* 通用移动端 (≤767px) */
@media (max-width: 767px) {
    .app-header {
        margin-bottom: var(--space-md);
    }

    .app-header-content {
        width: 100%;
        max-width: 100%;
        padding: 10px 12px;
        gap: 8px;
    }

    .brand h1 {
        font-size: 1.05rem;
    }

    .logo-icon img {
        width: 1.4rem;
        height: 1.4rem;
    }

    .card-header .btn {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .btn-block {
        padding: 12px;
        font-size: 0.95rem;
    }

    .form-control {
        font-size: 0.9rem;
        padding: 10px 12px;
    }

    textarea.form-control {
        min-height: 140px;
    }

    /* 管理员统计卡片 */
    #admin-container .stat-card {
        padding: var(--space-md) !important;
    }

    #admin-container .stat-card > div:first-child {
        font-size: 24px !important;
    }

    /* 管理员表格横向滚动 */
    #admin-history-section > div:first-of-type {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #admin-history-section table {
        min-width: 600px;
    }

    /* 管理员图片网格 */
    #admin-images-list {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important;
        gap: 10px !important;
        max-height: 50vh !important;
    }

    /* 弹窗移动端优化 */
    .modal-content {
        padding: 20px;
        width: calc(100% - 24px);
        max-height: calc(85vh - var(--safe-area-top) - var(--safe-area-bottom));
    }

    .close-btn {
        top: 12px;
        right: 12px;
    }

    /* 分段控制器 */
    .segmented-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .floating-action-bar {
        padding: 10px 16px;
        gap: 12px;
        font-size: 0.85rem;
    }

    /* 减小图片预览区的按钮大小 */
    .btn-preview-img,
    .btn-delete-img {
        width: 32px;
        height: 32px;
        top: 6px;
    }
    .btn-preview-img .ui-icon,
    .btn-delete-img .ui-icon {
        width: 16px;
        height: 16px;
    }
    .btn-delete-img {
        right: 6px;
    }
    .btn-preview-img {
        left: 6px;
    }
}

/* Tablet & Small Desktop (768-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .app-container {
        padding: 0 var(--space-lg);
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    .history-fullinfo-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .app-container {
        padding: 0 var(--space-lg);
    }

    .app-header-content {
        flex-direction: row;
        justify-content: space-between;
        padding: 16px var(--space-lg);
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .history-fullinfo-grid {
        grid-template-columns: 1fr 1fr;
    }

    .history-thumb-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    /* 桌面端 hover 效果恢复 */
    .card:hover {
        box-shadow: var(--shadow-md);
    }

    .preview-item:hover img {
        transform: scale(1.05);
    }

    .admin-image-item:hover .admin-image-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ==========================================================================
   Recent Generated Images
   ========================================================================== */
.recent-images-btn {
    border-radius: 20px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.recent-images-btn .ui-icon {
    width: 15px;
    height: 15px;
}

.recent-images-modal-content {
    max-width: 920px;
}

.recent-images-subtitle {
    margin: -8px 0 16px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}

.recent-images-subtitle strong {
    color: #334155;
}

.recent-images-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.recent-images-status {
    font-size: 13px;
    color: #64748b;
}

.recent-images-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-images-toolbar-actions .btn {
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 13px;
    white-space: nowrap;
}

.recent-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px;
}

.recent-image-item {
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    min-width: 0;
}

.recent-image-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    margin: 0;
    border: none;
    background: #e2e8f0;
    cursor: zoom-in;
    overflow: hidden;
}

.recent-image-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.recent-image-thumb:hover img {
    transform: scale(1.04);
}

.recent-image-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    background: #fff;
}

.recent-image-time {
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
    word-break: break-all;
    min-width: 0;
}

.recent-image-download {
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    min-height: 30px;
    white-space: nowrap;
    flex-shrink: 0;
}

.recent-images-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #64748b;
    padding: 36px 12px;
    font-size: 14px;
}

@media (max-width: 600px) {
    .app-header-content {
        gap: 6px;
    }

    .brand {
        flex: 1 1 auto;
        min-width: 0;
    }

    .brand h1 {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.95rem;
    }

    .brand h1 span {
        display: none;
    }

    .balance-badge {
        padding: 3px 8px;
        font-size: 0.72rem;
    }

    .recent-images-btn {
        padding: 6px 8px;
        min-width: 36px;
        justify-content: center;
    }

    .recent-images-btn-label {
        display: none;
    }

    #btn-open-admin {
        padding: 6px 8px;
        min-width: 36px;
        justify-content: center;
    }

    .admin-entry-label {
        display: none;
    }

    .recent-images-modal-content {
        max-width: 100%;
    }

    .recent-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
        max-height: 62vh;
    }

    .recent-image-info {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .recent-image-download {
        width: 100%;
    }
}

/* Background replacement picker */
.background-picker {
    margin-top: 16px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.background-picker-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}
.background-picker-title {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}
.background-picker-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}
.background-picker-current {
    font-size: 12px;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
}
.background-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}
.background-item {
    flex: 0 0 auto;
    width: 96px;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    background: #fff;
    cursor: pointer;
    position: relative;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.background-item img {
    display: block;
    width: 100%;
    height: 62px;
    object-fit: cover;
}
.background-item span {
    display: block;
    font-size: 12px;
    color: #475569;
    padding: 5px 2px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.background-item.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.background-item.active span {
    color: #1d4ed8;
    font-weight: 600;
}
.background-item.active::after {
    content: "\2713";
    position: absolute;
    top: 4px;
    right: 4px;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    line-height: 16px;
    text-align: center;
}

/* ============ Background task status bar ============ */
.task-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 20px;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
    font-size: 13px;
    color: #1e40af;
    cursor: pointer;
    user-select: none;
}
.task-status-bar.hidden { display: none; }
.task-status-bar:hover { background: #e0edff; }
.task-status-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.task-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex: 0 0 auto;
}
.task-status-bar.is-active { background: #fff7ed; border-bottom-color: #fed7aa; color: #9a3412; }
.task-status-bar.is-active .task-status-dot { background: #f97316; animation: taskPulse 1.2s infinite; }
.task-status-bar.is-failed { background: #fef2f2; border-bottom-color: #fecaca; color: #b91c1c; }
.task-status-bar.is-failed .task-status-dot { background: #ef4444; }
@keyframes taskPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}
.task-status-arrow { white-space: nowrap; font-size: 12px; opacity: 0.8; }

/* ============ Smart mode wizard ============ */
@property --smart-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

.smart-wizard { display: none; position: relative; --smart-angle: 0deg; }
body.smart-mode #main-control-panel,
body.smart-mode .workspace { display: none !important; }
body.smart-mode .smart-wizard { display: block; }

.smart-wizard { padding: 0; overflow: hidden; }
.smart-top {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px 12px;
    border-bottom: 1px solid #f1f5f9;
}
.smart-stepper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    width: 100%;
}
.smart-step-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 82px;
    color: #94a3b8;
    font-size: 12px;
    white-space: nowrap;
    transition: color 0.3s;
}
.smart-step-node span {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    transition: background 0.3s, color 0.3s, box-shadow 0.3s, transform 0.3s;
}
.smart-step-node em {
    font-style: normal;
    text-align: center;
    line-height: 1.2;
}
.smart-step-node.active { color: #2563eb; font-weight: 600; }
.smart-step-node.active span {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12), 0 0 18px rgba(59, 130, 246, 0.35);
    animation: smartActiveGlow 2.6s ease-in-out infinite;
}
.smart-step-node.done { color: #0f766e; }
.smart-step-node.done span {
    background: #10b981;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}
.smart-stepper i {
    flex: 0 0 44px;
    height: 2px;
    margin-top: 13px;
    border-radius: 999px;
    background: #e2e8f0;
    transition: background 0.3s;
}
.smart-step-node.done + i { background: linear-gradient(90deg, #10b981, #6ee7b7); }
.smart-step-node.active + i { background: linear-gradient(90deg, #93c5fd, #e2e8f0); }

/* 节点工作中的 Apple Intelligence 风格光环 */
.smart-step-node.completing span {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), 0 0 24px rgba(96, 165, 250, 0.45);
}
.smart-step-node.completing span::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: conic-gradient(from var(--smart-angle), #ff5f6d, #ffc371, #47e5bc, #4facfe, #b06ab3, #ff5f6d);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.65));
    opacity: 1;
    animation: smartAuraSpin 3.2s linear infinite;
    pointer-events: none;
}
.smart-step-node.completing span::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #fff;
    border-right-color: rgba(255, 255, 255, 0.55);
    opacity: 1;
    animation: smartSpin 0.85s linear infinite;
    pointer-events: none;
}
.smart-step-node.done span::before,
.smart-step-node.done span::after { display: none; }

@keyframes smartAuraSpin { to { --smart-angle: 360deg; } }
@keyframes smartSpin { to { transform: rotate(360deg); } }
@keyframes smartActiveGlow {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12), 0 0 18px rgba(59, 130, 246, 0.35);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.16), 0 0 26px rgba(96, 165, 250, 0.5), 0 0 42px rgba(168, 85, 247, 0.18);
    }
}

@media (prefers-reduced-motion: reduce) {
    .smart-step-node.active span,
    .smart-step-node.completing span::before,
    .smart-step-node.completing span::after,
    .smart-edge-glow {
        animation: none !important;
    }
    .smart-edge-glow { transition: none; }
}

/* 智能步骤处理中：手机屏幕 / 浏览器窗口外边缘泛光 */
.smart-edge-glow {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
    --smart-angle: 0deg;
    border: 3px solid transparent;
    border-image: conic-gradient(from var(--smart-angle), #ff5f6d, #ffc371, #47e5bc, #4facfe, #b06ab3, #ff5f6d) 1;
    box-shadow:
        inset 0 0 18px rgba(59, 130, 246, 0.55),
        inset 0 0 48px rgba(168, 85, 247, 0.38),
        inset 0 0 90px rgba(16, 185, 129, 0.24),
        inset 0 0 140px rgba(59, 130, 246, 0.12);
    animation: smartAuraSpin 3.2s linear infinite;
}
.smart-edge-glow.active,
body:has(.smart-step-node.completing) .smart-edge-glow {
    opacity: 1;
}

.smart-viewport { overflow: hidden; height: 0; transition: height 0.42s cubic-bezier(0.4, 0, 0.2, 1); }
.smart-track { display: flex; width: 300%; transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1); }
.smart-panel { width: 33.3333%; flex: 0 0 33.3333%; padding: 20px; box-sizing: border-box; }
.smart-panel-title { font-size: 16px; font-weight: 600; color: #1e293b; margin-bottom: 14px; }

.smart-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    padding: 26px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.smart-upload-zone:hover { border-color: #93c5fd; background: #f0f7ff; }
.smart-upload-icon img { width: 40px; height: 40px; opacity: 0.6; }
.smart-upload-title { margin-top: 8px; font-size: 15px; font-weight: 600; color: #334155; }
.smart-upload-sub { margin-top: 4px; font-size: 12px; color: #94a3b8; }
.smart-upload-zone .btn { margin-top: 14px; }

.smart-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.smart-image-grid.hidden { display: none; }
.smart-image-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: #eef2f7;
    border: 2px solid transparent;
}
.smart-image-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.smart-image-item.status-nameplate { border-color: #3b82f6; }
.smart-image-item.status-dealer { border-color: #ef4444; }
.smart-image-item.status-valid { border-color: #10b981; }
.smart-image-item.status-unknown { border-color: #9ca3af; }
.smart-image-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}
.smart-image-tag {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    color: #fff;
    font-size: 10px;
    text-align: center;
    padding: 2px 0;
}
.smart-image-item.is-uploading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, #eef2f7 8%, #f8fafc 18%, #eef2f7 33%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}

.smart-next-btn { margin-top: 20px; }
.smart-textarea {
    min-height: 180px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.6;
}
.smart-paste-btn { margin-top: 10px; }
.smart-price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
    margin-top: 16px;
}
.smart-price-grid .form-group { margin-bottom: 14px; }
.smart-input-wrap { position: relative; }
.smart-input-wrap .form-control { padding-right: 36px; }
.smart-input-wrap > span {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
}
.profit-converted {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    line-height: 1.4;
    color: #10b981;
    font-weight: 600;
    white-space: nowrap;
}
.profit-converted:empty { display: none; }
.profit-field-wrap { position: relative; }
.profit-field-wrap .form-control { padding-right: 68px; }
.profit-field-wrap input[type="number"]::-webkit-outer-spin-button,
.profit-field-wrap input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.profit-field-wrap input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}
.profit-preset-toggle {
    position: absolute;
    right: 34px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    line-height: 1;
    padding: 6px;
    cursor: pointer;
    z-index: 2;
}
.profit-preset-toggle:hover { color: #2563eb; }
.profit-currency {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
}
.profit-preset-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 60;
    background: #fff;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
    padding: 6px;
    max-height: 220px;
    overflow-y: auto;
}
.profit-preset-option {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
}
.profit-preset-option:hover,
.profit-preset-option:focus {
    background: #eff6ff;
    color: #1d4ed8;
    outline: none;
}
.smart-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}
.smart-actions .btn-accent { margin-left: auto; min-width: 130px; }

.smart-recognize-status {
    font-size: 13px;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 14px;
}
.smart-recognize-status.is-ok { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.smart-recognize-status.is-error { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

.smart-confirm-layout {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr;
    gap: 16px;
    align-items: start;
}
.smart-nameplate-title { font-size: 13px; color: #64748b; margin-bottom: 8px; }
.smart-nameplate-frame {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.smart-nameplate-frame img { width: 100%; height: auto; display: block; }
.smart-nameplate-empty { font-size: 12px; color: #94a3b8; text-align: center; line-height: 1.7; padding: 16px 10px; }
.smart-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.smart-fields .form-group { margin-bottom: 12px; }
.smart-mode-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.smart-mode-desc { font-size: 12px; color: #94a3b8; line-height: 1.6; }

@media (max-width: 640px) {
    .smart-panel { padding: 14px; }
    .smart-top { padding: 16px 10px 10px; }
    .smart-step-node { min-width: 64px; gap: 5px; font-size: 11px; }
    .smart-step-node span { width: 26px; height: 26px; font-size: 11px; }
    .smart-stepper i { flex: 0 0 24px; margin-top: 12px; }
    .smart-price-grid { grid-template-columns: 1fr; }
    .smart-confirm-layout { grid-template-columns: 1fr; }
    .smart-fields { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
    .smart-fields { grid-template-columns: 1fr; }
    .smart-step-node { min-width: 54px; font-size: 10.5px; }
    .smart-step-node em { max-width: 56px; white-space: normal; }
    .smart-stepper i { flex: 0 0 14px; }
}

/* ============ Tasks page ============ */
.tasks-page { padding: 24px 18px 60px; max-width: 1100px; margin: 0 auto; }
.tasks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.tasks-header h1 { font-size: 20px; margin: 0; color: #0f172a; }
.tasks-header-actions { display: flex; gap: 10px; }
.tasks-summary { font-size: 13px; color: #64748b; margin-bottom: 14px; }
.tasks-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.tasks-scope-all {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.tasks-scope-all input { width: 14px; height: 14px; accent-color: #2563eb; }
@media (max-width: 720px) {
    .tasks-scope-all { height: 34px; padding: 0 10px; }
}
.tasks-search-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.tasks-search-input { padding-right: 38px; }
.tasks-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
}
.tasks-search-clear:hover { color: #475569; }
.tasks-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 22px;
}
.tasks-page-info { font-size: 13px; color: #64748b; }
.task-image-fallback.is-expired { color: #b91c1c; }
@media (max-width: 720px) {
    .tasks-toolbar { align-items: stretch; }
}
.task-list { display: flex; flex-direction: column; gap: 14px; }
.task-item {
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.task-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #cbd5e1;
}
.task-item--completed::before { background: #10b981; }
.task-item--failed::before { background: #ef4444; }
.task-item--processing::before { background: #f59e0b; }
.task-item--queued::before { background: #94a3b8; }
.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    border-color: #bfdbfe;
}
.task-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.task-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 0 24px;
}
.task-item-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-wrap: wrap;
}
.task-item-id {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}
.task-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.task-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
}
.task-badge.queued { background: #f1f5f9; color: #475569; }
.task-badge.processing { background: #fff7ed; color: #c2410c; }
.task-badge.completed { background: #ecfdf5; color: #047857; }
.task-badge.failed { background: #fef2f2; color: #b91c1c; }
.task-badge.processing::before { animation: taskPulse 1.2s infinite; }

.task-item-price {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}
.task-price-label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.task-price-value {
    font-size: 20px;
    line-height: 1.15;
    font-weight: 800;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.task-item-price--empty .task-price-value {
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
}

.task-item-body { padding: 12px 20px 0 24px; }
.task-item-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.task-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 10px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #eef2f6;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}
.task-meta-chip strong { color: #334155; font-weight: 600; }
.task-meta-chip span { color: #94a3b8; }
.task-meta-chip--step { background: #eff6ff; border-color: #dbeafe; color: #1d4ed8; }
.task-meta-chip--step strong { color: #1d4ed8; }
.task-meta-chip--step span { color: #60a5fa; }
.task-meta-icon { width: 14px; height: 14px; flex: 0 0 auto; opacity: 0.8; }

.task-item-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #b91c1c;
    font-size: 12.5px;
    line-height: 1.55;
}
.task-item-error .task-meta-icon { width: 16px; height: 16px; margin-top: 1px; opacity: 0.9; }
.task-item-error span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.task-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px 0 24px;
}
.task-progress {
    flex: 1 1 auto;
    height: 6px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
}
.task-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: inherit;
    transition: width 0.35s ease;
}
.task-progress-text {
    min-width: 34px;
    text-align: right;
    font-size: 12px;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.task-item-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding: 14px 20px 16px 24px;
    border-top: 1px solid #f1f5f9;
    background: rgba(248, 250, 252, 0.55);
}
.task-item-hint { font-size: 12px; color: #94a3b8; }
.task-item-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-action-btn {
    appearance: none;
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}
.task-action-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
    transform: translateY(-1px);
}
.task-action-btn:active { transform: translateY(0); }
.task-action-btn--warning { color: #b45309; border-color: #fde68a; background: #fffbeb; }
.task-action-btn--warning:hover { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.task-action-btn--danger { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.task-action-btn--danger:hover { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.task-action-btn--tracking { color: #1d4ed8; border-color: #bfdbfe; background: linear-gradient(135deg, #eff6ff, #f5f3ff); }
.task-action-btn--tracking:hover { background: linear-gradient(135deg, #dbeafe, #ede9fe); border-color: #93c5fd; color: #1e40af; }

.task-empty { text-align: center; color: #94a3b8; padding: 50px 20px; }

@media (max-width: 720px) {
    .task-item-head {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 16px 16px 0 20px;
    }
    .task-item-price { text-align: left; }
    .task-item-body { padding: 10px 16px 0 20px; }
    .task-progress-row { padding: 12px 16px 0 20px; }
    .task-item-foot {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 16px 14px 20px;
    }
    .task-item-hint { display: none; }
    .task-item-actions { width: 100%; }
    .task-action-btn { flex: 1 1 0; text-align: center; }
    .task-item-meta { gap: 6px; }
    .task-meta-chip { padding: 4px 8px; font-size: 11.5px; }
}

.task-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.task-detail-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 14px; }
.task-detail-card h3 { margin: 0 0 10px; font-size: 14px; color: #334155; }
.task-detail-line { font-size: 13px; color: #475569; margin-bottom: 6px; word-break: break-all; }
.task-detail-text { white-space: pre-wrap; font-size: 13px; line-height: 1.7; color: #334155; max-height: 320px; overflow: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; }
.task-detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* 任务详情图片区（在任务信息上方直接展示，支持长按保存） */
.task-detail-images-card { margin-bottom: 14px; background: #fff; }
.task-detail-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.task-detail-card-head h3 { margin: 0; }
.task-images-hint { font-size: 12px; color: #64748b; }
.task-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.task-image-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid #e2e8f0; background: #f1f5f9; aspect-ratio: 4 / 3; }
.task-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
    -webkit-touch-callout: default;
    -webkit-user-select: auto;
    user-select: auto;
    background: #f1f5f9;
}
.task-image-item img.is-failed { display: none; }
.task-image-name { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 2px 9px; border-radius: 999px; background: rgba(15, 23, 42, 0.62); color: #fff; font-size: 11px; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-image-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; font-size: 12px; color: #94a3b8; }
.task-error { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 10px 12px; font-size: 13px; white-space: pre-wrap; margin-bottom: 14px; }
@media (max-width: 720px) {
    .task-detail-grid { grid-template-columns: 1fr; }
    .task-item-right { width: 100%; justify-content: flex-end; }
    .task-images { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .task-images-hint { font-size: 11px; }
    .task-detail-images-card { padding: 12px; }
}

/* ============ UI refresh: line icons, illustrations & motion ============ */
.ui-icon {
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.btn:hover:not(:disabled) .ui-icon {
    transform: translateY(-1px) scale(1.04);
}
.btn-primary .ui-icon,
.btn-accent .ui-icon,
.btn[style*="background-color: #3b82f6"] .ui-icon,
.btn[style*="background: #3b82f6"] .ui-icon,
.btn[style*="background-color: #ef4444"] .ui-icon,
.btn[style*="background: #ef4444"] .ui-icon,
.btn[style*="background-color: #10b981"] .ui-icon {
    filter: brightness(0) invert(1);
}
.btn-primary:hover:not(:disabled),
.btn-accent:hover:not(:disabled) {
    transform: translateY(-1px);
}
.btn:focus-visible,
.background-item:focus-visible,
.bottom-tab-item:focus-visible,
.task-item:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.empty-state .icon img {
    min-width: 96px;
    max-width: 150px;
    height: auto !important;
    opacity: 1 !important;
    filter: none !important;
}
.empty-state p {
    margin-top: 10px;
}

/* Bottom navigation */
.bottom-tab-item {
    position: relative;
    gap: 3px;
}
.bottom-tab-item .tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 24px;
    border-radius: 12px;
    transition: background-color 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bottom-tab-item .tab-icon svg {
    width: 21px;
    height: 21px;
    display: block;
}
.bottom-tab-item.active .tab-icon {
    background: #eff6ff;
    transform: translateY(-1px);
}
.bottom-tab-item.active .tab-icon svg {
    stroke: var(--primary-color);
}
.bottom-tab-item:active .tab-icon {
    transform: scale(0.9);
}

/* Task status bar */
.task-status-arrow {
    transition: transform 0.22s ease, opacity 0.22s ease;
}
.task-status-bar:hover .task-status-arrow {
    transform: translateX(3px);
    opacity: 1;
}

/* Background picker */
.background-item {
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}
.background-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}
.background-item:active {
    transform: scale(0.97);
}
.background-item.active {
    transform: translateY(-2px);
}

/* Cards & list items */
.card {
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover {
    border-color: #dbe3ee;
}
.admin-image-item,
.task-image-item,
.history-thumb-item,
.smart-image-item {
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s ease;
}
.admin-image-item:hover,
.task-image-item:hover,
.history-thumb-item:hover,
.smart-image-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}
.smart-image-item {
    animation: smartItemIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes smartItemIn {
    from { opacity: 0; transform: scale(0.88); }
    to { opacity: 1; transform: scale(1); }
}

/* Smooth page + section transitions */
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
    .admin-images-section,
    .admin-history-section {
        animation: sectionIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    }
    @keyframes sectionIn {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
    }
    .toast {
        backdrop-filter: blur(10px);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* Tasks empty state */
.task-empty img {
    max-width: 100%;
    height: auto;
}

/* Switch polish */
.switch { display: inline-flex; }
.switch .slider {
    display: block;
    background-color: #cbd5e1;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.16);
}
.switch input:checked + .slider {
    background-color: #2563eb;
    background-image: linear-gradient(135deg, #3b82f6, #7c3aed);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}
.switch .slider::before {
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.28);
}

/* ============ History page ============ */
.history-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 22px 18px 70px;
    width: 100%;
    box-sizing: border-box;
}
.history-account-label {
    font-size: 13px;
    color: #64748b;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.history-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 28px;
    border-radius: 20px;
    background: linear-gradient(120deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
    color: #fff;
    overflow: hidden;
    box-shadow: 0 16px 38px rgba(37, 99, 235, 0.28);
}
.history-hero::before,
.history-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.13);
    pointer-events: none;
}
.history-hero::before {
    width: 220px;
    height: 220px;
    right: 120px;
    top: -120px;
}
.history-hero::after {
    width: 140px;
    height: 140px;
    right: -40px;
    bottom: -70px;
}
.history-hero-copy {
    position: relative;
    z-index: 1;
    min-width: 0;
}
.history-hero-copy h1 {
    margin: 0 0 6px;
    font-size: 25px;
    line-height: 1.25;
    letter-spacing: 0.2px;
}
.history-hero-copy p {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.82);
    max-width: 520px;
}
.history-hero-stats {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 12px;
    flex: 0 0 auto;
}
.history-stat {
    min-width: 96px;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(8px);
    text-align: center;
}
.history-stat strong {
    display: block;
    font-size: 26px;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.history-stat span {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.78);
}

.history-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
    flex-wrap: wrap;
}
.history-search-wrap {
    position: relative;
    flex: 1 1 280px;
    min-width: 220px;
}
.history-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}
.history-search-input {
    width: 100%;
    height: 46px;
    box-sizing: border-box;
    padding: 0 40px 0 42px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}
.history-search-input:focus {
    border-color: #93c5fd;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}
.history-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    font-size: 15px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}
.history-search-clear.hidden { display: none; }
.history-search-btn {
    height: 46px;
    padding: 0 24px;
    border-radius: 12px;
    white-space: nowrap;
}
.history-only-mine {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #475569;
    padding: 0 6px;
    cursor: pointer;
    min-height: 44px;
    user-select: none;
}
.history-only-mine input {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
}
.history-search-error {
    margin-top: 10px;
    font-size: 13px;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 8px 12px;
}
.history-search-error.hidden { display: none; }
.history-summary {
    margin: 14px 4px 12px;
    font-size: 13px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
}
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.history-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
    animation: historyCardIn 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s, border-color 0.22s;
}
.history-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
    border-color: #bfdbfe;
}
@keyframes historyCardIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.history-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.history-card-price {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: baseline;
    gap: 4px;
}
.history-price-sign {
    font-size: 16px;
    font-weight: 600;
    color: #2563eb;
}
.history-detail-btn {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 7px 16px;
}
.history-card-vin {
    margin-top: 6px;
    font-size: 13px;
    color: #334155;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.4px;
    word-break: break-all;
}
.history-card-vin span {
    display: inline-block;
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 1px;
    color: #94a3b8;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 1px 6px;
    margin-right: 8px;
    vertical-align: 1px;
}
.history-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-top: 10px;
    font-size: 12px;
    color: #64748b;
}
.history-operator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.history-operator i {
    font-style: normal;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    color: #4338ca;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.history-time { color: #94a3b8; }
.history-chip {
    background: #f1f5f9;
    color: #475569;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 11px;
    white-space: nowrap;
}
.history-chip-profit {
    background: #ecfdf5;
    color: #047857;
}
.history-card-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
    font-size: 12px;
    color: #94a3b8;
}
.history-loading {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.history-skeleton {
    height: 122px;
    border-radius: 16px;
    background: linear-gradient(110deg, #eef2f7 8%, #f8fafc 18%, #eef2f7 33%);
    background-size: 200% 100%;
    animation: shimmer 1.3s linear infinite;
}
.history-empty {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
    background: #fff;
    border: 1px dashed #e2e8f0;
    border-radius: 16px;
}
.history-empty img {
    width: 160px;
    max-width: 70%;
    height: auto;
    display: block;
    margin: 0 auto 10px;
}
.history-empty p {
    margin: 0 0 14px;
    font-size: 14px;
}
.history-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}
.history-load-more-wrap.hidden { display: none; }

/* History detail */
.history-detail-modal-content {
    max-width: 920px;
    text-align: left;
}
.history-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-right: 34px;
    margin-bottom: 16px;
}
.history-detail-head h2 {
    margin: 0;
    font-size: 27px;
    color: #0f172a;
    border: none;
    padding: 0;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}
.history-detail-sub {
    margin-top: 5px;
    font-size: 13px;
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    word-break: break-all;
}
.history-badge {
    flex: 0 0 auto;
    font-size: 12px;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 4px 10px;
}
.history-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.history-detail-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
}
.history-detail-card h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 10px;
    font-size: 14px;
    color: #334155;
}
.history-detail-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    font-size: 13px;
    color: #475569;
    padding: 4px 0;
}
.history-detail-line span {
    color: #94a3b8;
    flex: 0 0 auto;
}
.history-detail-line strong {
    color: #1e293b;
    font-weight: 600;
    text-align: right;
    word-break: break-all;
    font-variant-numeric: tabular-nums;
}
.history-detail-total {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px dashed #cbd5e1;
}
.history-detail-total strong {
    font-size: 17px;
    color: #2563eb;
}
.history-detail-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.75;
    color: #334155;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    max-height: 300px;
    overflow: auto;
}
.history-detail-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}
.history-detail-image {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    position: relative;
}
.history-detail-image img {
    width: 100%;
    height: 94px;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}
.history-image-fallback {
    position: absolute;
    inset: 0 0 34px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #94a3b8;
    background: #f8fafc;
    text-align: center;
    padding: 8px;
}
.history-image-fallback.is-expired { color: #b91c1c; }
.history-detail-image button {
    width: 100%;
    border: none;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    padding: 7px 4px;
    cursor: pointer;
}
.history-detail-empty {
    font-size: 13px;
    color: #94a3b8;
    padding: 8px 0;
}
.history-image-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(15, 23, 42, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(6px);
}
.history-image-modal.hidden { display: none; }
.history-image-modal img {
    max-width: 94vw;
    max-height: 92vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

@media (max-width: 720px) {
    .history-page { padding: 16px 12px 70px; }
    .history-hero {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        gap: 16px;
    }
    .history-hero-copy h1 { font-size: 21px; }
    .history-hero-stats { width: 100%; }
    .history-stat { flex: 1; min-width: 0; padding: 10px 8px; }
    .history-stat strong { font-size: 22px; }
    .history-toolbar { padding: 10px; gap: 10px; }
    .history-search-wrap { flex: 1 1 100%; }
    .history-search-btn { flex: 1; }
    .history-only-mine { flex: 0 0 auto; }
    .history-card { padding: 14px; }
    .history-card-price { font-size: 22px; }
    .history-card-top { align-items: flex-start; }
    .history-account-label { display: none; }
    .history-detail-grid { grid-template-columns: 1fr; }
    .history-detail-head h2 { font-size: 22px; }
    .history-detail-modal-content { padding: 16px; }
}

/* ============ Tags page ============ */
.tags-page {
    max-width: 1040px;
    margin: 0 auto;
    padding: 22px 18px 70px;
    width: 100%;
    box-sizing: border-box;
}
.tags-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 26px;
    border-radius: 20px;
    background: linear-gradient(120deg, #0ea5e9 0%, #2563eb 55%, #6d28d9 100%);
    color: #fff;
    box-shadow: 0 16px 38px rgba(37, 99, 235, 0.26);
    position: relative;
    overflow: hidden;
}
.tags-hero::before {
    content: "";
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    right: 100px;
    top: -120px;
}
.tags-hero-copy { position: relative; z-index: 1; min-width: 0; }
.tags-hero-copy h1 { margin: 0 0 6px; font-size: 24px; }
.tags-hero-copy p { margin: 0; font-size: 13px; color: rgba(255,255,255,0.84); }
.tags-hero-count {
    position: relative;
    z-index: 1;
    min-width: 106px;
    padding: 12px 16px;
    text-align: center;
    border-radius: 14px;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.22);
    backdrop-filter: blur(8px);
}
.tags-hero-count strong { display: block; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tags-hero-count span { display: block; font-size: 11px; color: rgba(255,255,255,0.78); margin-top: 3px; }

.tags-add-card {
    margin-top: 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 6px 20px rgba(15,23,42,0.05);
}
.tags-add-head h2 { margin: 0 0 4px; font-size: 16px; color: #1e293b; }
.tags-add-head p { margin: 0 0 12px; font-size: 12px; color: #94a3b8; }
.tags-add-head code { background: #f1f5f9; border-radius: 5px; padding: 1px 5px; font-size: 12px; color: #475569; }
.tags-add-row { display: flex; gap: 10px; }
.tags-input {
    flex: 1;
    height: 46px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    padding: 0 14px;
    font-size: 14px;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.tags-input:focus { border-color: #93c5fd; background: #fff; box-shadow: 0 0 0 4px rgba(59,130,246,0.12); }
.tags-add-row .btn { height: 46px; padding: 0 22px; border-radius: 12px; white-space: nowrap; }
.tags-error { margin-top: 10px; font-size: 13px; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 8px 12px; }
.tags-error.hidden { display: none; }

.tags-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 16px 2px 12px;
    flex-wrap: wrap;
}
.tags-search-wrap {
    position: relative;
    flex: 1 1 240px;
    max-width: 360px;
}
.tags-search-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 16px;
    height: 16px;
    color: #94a3b8;
    transform: translateY(-50%);
    pointer-events: none;
}
.tags-search {
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    padding: 0 12px 0 36px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.tags-search:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.tags-summary { font-size: 13px; color: #64748b; }

.tags-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.tag-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 14px 14px 12px;
    box-shadow: 0 2px 8px rgba(15,23,42,0.03);
    animation: historyCardIn 0.34s cubic-bezier(0.2,0.8,0.2,1) both;
    transition: transform 0.2s cubic-bezier(0.2,0.8,0.2,1), box-shadow 0.2s, border-color 0.2s;
}
.tag-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15,23,42,0.09); border-color: #bfdbfe; }
.tag-card-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 11px;
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    color: #4338ca;
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tag-card-body { min-width: 0; flex: 1; }
.tag-card-text { font-size: 14px; font-weight: 600; color: #1e293b; word-break: break-all; }
.tag-card-meta { margin-top: 3px; font-size: 11px; color: #94a3b8; }
.tag-card-delete {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, filter 0.2s;
}
.tag-card-delete img { width: 17px; height: 17px; opacity: 0.5; }
.tag-card-delete:hover { background: #fef2f2; }
.tag-card-delete:hover img { opacity: 1; filter: invert(36%) sepia(94%) saturate(2414%) hue-rotate(338deg) brightness(94%) contrast(93%); }
.tags-loading { display: contents; }
.tags-skeleton {
    height: 66px;
    border-radius: 14px;
    background: linear-gradient(110deg, #eef2f7 8%, #f8fafc 18%, #eef2f7 33%);
    background-size: 200% 100%;
    animation: shimmer 1.3s linear infinite;
}
.tags-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 46px 20px;
    color: #94a3b8;
    background: #fff;
    border: 1px dashed #e2e8f0;
    border-radius: 16px;
}
.tags-empty img { width: 150px; max-width: 70%; height: auto; display: block; margin: 0 auto 10px; }
.tags-empty p { margin: 0 0 14px; font-size: 14px; }

.tag-confirm {
    position: fixed;
    inset: 0;
    z-index: 2500;
    background: rgba(15,23,42,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}
.tag-confirm.hidden { display: none; }
.tag-confirm-box {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 24px 60px rgba(15,23,42,0.3);
    animation: tagConfirmIn 0.22s cubic-bezier(0.2,0.8,0.2,1);
}
@keyframes tagConfirmIn { from { opacity: 0; transform: scale(0.94) translateY(8px); } to { opacity: 1; transform: none; } }
.tag-confirm-box h3 { margin: 0 0 8px; font-size: 17px; color: #0f172a; }
.tag-confirm-box p { margin: 0 0 18px; font-size: 13px; color: #64748b; line-height: 1.6; word-break: break-all; }
.tag-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.tags-confirm-danger { background: #ef4444; color: #fff; border: none; }
.tags-confirm-danger:hover:not(:disabled) { background: #dc2626; }

/* ============ Settings page ============ */
.settings-page {
    max-width: 980px;
    margin: 0 auto;
    padding: 22px 18px 80px;
    width: 100%;
    box-sizing: border-box;
}
.settings-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 26px;
    border-radius: 20px;
    background: linear-gradient(120deg, #4f46e5 0%, #2563eb 55%, #7c3aed 100%);
    color: #fff;
    box-shadow: 0 16px 38px rgba(79, 70, 229, 0.25);
    position: relative;
    overflow: hidden;
}
.settings-hero::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    right: -60px;
    top: -110px;
}
.settings-avatar {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    border-radius: 18px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    backdrop-filter: blur(8px);
}
.settings-hero-copy { position: relative; z-index: 1; min-width: 0; flex: 1; }
.settings-hero-copy h1 { margin: 0 0 4px; font-size: 23px; word-break: break-all; }
.settings-hero-copy p { margin: 0 0 8px; font-size: 12px; color: rgba(255,255,255,0.78); }
.settings-badge {
    display: inline-block;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.28);
    color: #fff;
}
.settings-badge.is-on { background: rgba(16,185,129,0.28); border-color: rgba(167,243,208,0.6); }
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}
.settings-span-2 { grid-column: 1 / -1; }
.settings-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 4px 14px rgba(15,23,42,0.04);
    animation: historyCardIn 0.35s cubic-bezier(0.2,0.8,0.2,1) both;
}
.settings-card h2 { margin: 0 0 12px; font-size: 16px; color: #1e293b; }
.settings-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.settings-card-head h2 { margin: 0; }
.settings-desc { margin: 0 0 12px; font-size: 12px; color: #94a3b8; line-height: 1.65; }
.settings-status {
    display: inline-block;
    font-size: 12px;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 4px 12px;
}
.settings-status.is-on { color: #047857; background: #ecfdf5; }
.settings-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.settings-chip {
    font-size: 12px;
    color: #4338ca;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    padding: 3px 10px;
    font-variant-numeric: tabular-nums;
}
.settings-contacts { display: flex; flex-direction: column; gap: 10px; }
.settings-contact-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr 40px;
    gap: 10px;
    align-items: center;
}
.settings-contact-row .form-control { height: 42px; }
.settings-contact-remove {
    width: 38px;
    height: 38px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}
.settings-contact-remove img { width: 16px; height: 16px; opacity: 0.55; }
.settings-contact-remove:hover { background: #fef2f2; border-color: #fecaca; }
.settings-contact-empty { font-size: 13px; color: #94a3b8; padding: 4px 0; }
.settings-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.settings-stat {
    text-align: center;
    padding: 14px 8px;
    border-radius: 13px;
    background: linear-gradient(160deg, #f8fafc, #eff6ff);
    border: 1px solid #e2e8f0;
}
.settings-stat strong {
    display: block;
    font-size: 22px;
    color: #1e3a8a;
    font-variant-numeric: tabular-nums;
    word-break: break-all;
}
.settings-stat span { display: block; margin-top: 3px; font-size: 11px; color: #64748b; }
.settings-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}
.settings-save-btn { min-width: 160px; border-radius: 12px; }
.settings-login {
    background: #fff;
    border: 1px dashed #e2e8f0;
    border-radius: 16px;
    text-align: center;
    padding: 46px 20px;
    color: #94a3b8;
}
.settings-login img { width: 150px; max-width: 70%; height: auto; display: block; margin: 0 auto 10px; }
.settings-login p { margin: 0 0 14px; font-size: 14px; }

@media (max-width: 720px) {
    .tags-page, .settings-page { padding: 14px 12px 76px; }
    .tags-hero { padding: 20px; }
    .tags-hero-copy h1 { font-size: 21px; }
    .tags-add-row { flex-direction: column; }
    .tags-add-row .btn { width: 100%; }
    .tags-list { grid-template-columns: 1fr; }
    .settings-hero { padding: 20px; }
    .settings-hero-copy h1 { font-size: 20px; }
    .settings-grid { grid-template-columns: 1fr; }
    .settings-span-2 { grid-column: auto; }
    .settings-stats { grid-template-columns: repeat(2, 1fr); }
    .settings-contact-row { grid-template-columns: 1fr 1fr 38px; gap: 8px; }
    .settings-actions { flex-direction: column-reverse; }
    .settings-actions .btn { width: 100%; }
}

/* ============ Direct page switching (no page animation) ============ */
.app-container,
.app-main,
.fade-in {
    animation: none !important;
}

/* ============ Smart wizard: direct step swap, no slide ============ */
.smart-viewport {
    height: auto !important;
    overflow: visible;
    transition: none;
}
.smart-track {
    display: block;
    width: auto;
    transform: none !important;
    transition: none;
}
.smart-panel {
    display: none;
    width: 100%;
    flex: 0 0 auto;
    padding: 20px;
    box-sizing: border-box;
}
.smart-panel.active { display: block; }
.smart-wizard { padding-bottom: 2px; }

/* ============ Smart upload dropzone ============ */
.smart-upload-zone {
    padding: 14px 16px 16px;
    text-align: left;
    cursor: pointer;
}
.smart-upload-zone.is-dragover {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}
.smart-upload-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.smart-upload-head .btn { flex: 0 0 auto; }
.smart-upload-title { font-size: 15px; font-weight: 600; color: #334155; }
.smart-upload-sub { margin-top: 3px; font-size: 12px; color: #94a3b8; line-height: 1.5; }
.smart-upload-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 26px 10px 16px;
    color: #94a3b8;
    font-size: 12px;
}
.smart-upload-empty img { width: 34px; height: 34px; opacity: 0.55; }
.smart-upload-empty.hidden { display: none; }
.smart-upload-zone .smart-image-grid { margin-top: 12px; }

/* ============ Task detail action bar ============ */
.task-detail-actionbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #eff6ff, #f5f3ff);
    border: 1px solid #dbeafe;
    border-radius: 12px;
}
.task-detail-actionbar .btn { border-radius: 999px; }
.task-detail-actionbar-hint { margin-left: auto; font-size: 12px; color: #64748b; }

/* Task detail: responsive info cards */
.task-detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ============ WeChat Agent page ============ */
.wechat-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 22px 18px 80px;
    width: 100%;
    box-sizing: border-box;
}
.wechat-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 26px;
    border-radius: 20px;
    background: linear-gradient(120deg, #07c160 0%, #059669 55%, #0f766e 100%);
    color: #fff;
    box-shadow: 0 16px 38px rgba(5, 150, 105, 0.26);
    position: relative;
    overflow: hidden;
}
.wechat-hero::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    right: -60px;
    top: -120px;
}
.wechat-hero-icon {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}
.wechat-hero-icon svg { width: 30px; height: 30px; }
.wechat-hero-copy { position: relative; z-index: 1; flex: 1; min-width: 0; }
.wechat-hero-copy h1 { margin: 0 0 4px; font-size: 23px; }
.wechat-hero-copy p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, 0.84); max-width: 640px; }
.wechat-hero-badge {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    white-space: nowrap;
}
.wechat-hero-badge.is-on { background: rgba(255, 255, 255, 0.26); border-color: rgba(255, 255, 255, 0.6); }
.wechat-hero-badge.is-off { background: rgba(15, 23, 42, 0.22); }
.wechat-hero-badge.is-wait { background: rgba(255, 255, 255, 0.16); }

.wechat-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 16px;
    margin-top: 16px;
}
.wechat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
    margin-bottom: 16px;
}
.wechat-card h2 { margin: 0 0 12px; font-size: 16px; color: #1e293b; }
.wechat-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.wechat-card-head h2 { margin: 0; }
.wechat-link { font-size: 13px; color: #059669; text-decoration: none; font-weight: 500; }
.wechat-link:hover { text-decoration: underline; }

.wechat-qr-card { text-align: center; }
.wechat-mode-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 9px;
    border-radius: 999px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
    font-size: 12px;
    font-weight: 500;
    vertical-align: middle;
}
.wechat-qr-box {
    width: 230px;
    height: 230px;
    max-width: 100%;
    margin: 4px auto 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden;
}
.wechat-qr-box img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 10px; background: #fff; }
.wechat-qr-placeholder { font-size: 13px; color: #94a3b8; line-height: 1.7; padding: 10px; }
.wechat-qr-status { font-size: 13px; color: #475569; }
.wechat-qr-timer { font-size: 12px; color: #94a3b8; margin-top: 4px; min-height: 16px; }
.wechat-qr-actions { display: flex; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.wechat-unbind-btn { color: #b91c1c; border-color: #fecaca; }
.wechat-unbind-btn:hover:not(:disabled) { background: #fef2f2; border-color: #fca5a5; }
.wechat-keepalive {
    margin-top: 14px;
    font-size: 12px;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    padding: 5px 12px;
}
.wechat-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: wechatPulse 1.6s infinite;
}
@keyframes wechatPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    60% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}
.wechat-connected {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #047857;
}
.wechat-connected span {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #ecfdf5;
    border: 2px solid #a7f3d0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
}
.wechat-connected strong { font-size: 15px; }
.wechat-connected small { font-size: 12px; color: #059669; }

.wechat-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.wechat-steps li { display: flex; gap: 12px; align-items: flex-start; }
.wechat-steps li > span {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wechat-steps strong { font-size: 13px; color: #1e293b; }
.wechat-steps p { margin: 2px 0 0; font-size: 12px; color: #94a3b8; line-height: 1.6; }
.wechat-binding-info {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.wechat-binding-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; padding: 3px 0; }
.wechat-binding-row span { color: #64748b; }
.wechat-binding-row strong { color: #065f46; font-weight: 600; word-break: break-all; text-align: right; }
.wechat-binding-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.wechat-binding-stats span { font-size: 11px; background: #fff; border: 1px solid #d1fae5; color: #047857; border-radius: 999px; padding: 2px 9px; }
.wechat-config-hint {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    font-size: 12px;
    color: #92400e;
    line-height: 1.7;
}
.wechat-config-hint strong { display: block; margin-bottom: 4px; font-size: 13px; }
.wechat-config-hint p { margin: 4px 0; }
.wechat-config-hint code { background: #fef3c7; border-radius: 5px; padding: 1px 5px; word-break: break-all; }

.wechat-task-list { display: flex; flex-direction: column; gap: 8px; }
.wechat-task-item {
    display: block;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.wechat-task-item:hover { border-color: #a7f3d0; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(5, 150, 105, 0.08); }
.wechat-task-main { display: flex; align-items: center; gap: 10px; }
.wechat-task-id { font-weight: 700; color: #1e293b; font-size: 14px; }
.wechat-task-total { margin-left: auto; font-weight: 700; color: #065f46; font-variant-numeric: tabular-nums; }
.wechat-task-meta { margin-top: 4px; font-size: 12px; color: #94a3b8; }
.wechat-task-empty { text-align: center; color: #94a3b8; padding: 32px 16px; font-size: 13px; }
.wechat-task-empty img { width: 130px; max-width: 60%; height: auto; display: block; margin: 0 auto 10px; }
.wechat-task-empty p { margin: 0; }

@media (max-width: 760px) {
    .wechat-page { padding: 14px 12px 76px; }
    .wechat-hero { flex-wrap: wrap; padding: 20px; }
    .wechat-hero-copy h1 { font-size: 20px; }
    .wechat-hero-badge { margin-left: 74px; }
    .wechat-grid { grid-template-columns: 1fr; }
    .wechat-qr-box { width: 210px; height: 210px; }
}

/* WeChat test account re-open helper */
.wechat-find-card summary {
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.wechat-find-card summary::-webkit-details-marker { display: none; }
.wechat-find-card summary::before {
    content: "+";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ecfdf5;
    color: #047857;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.wechat-find-card details[open] summary::before { content: "-"; }
.wechat-find-body { margin-top: 12px; text-align: center; }
.wechat-find-body p { margin: 0 0 12px; font-size: 12px; color: #94a3b8; line-height: 1.7; }
.wechat-find-body img { width: 220px; max-width: 70%; border-radius: 10px; border: 1px solid #e2e8f0; }
/* ==========================================================================
   Admin Shell - 电脑端左侧任务栏布局
   ========================================================================== */
#admin-container {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    background: #f1f5f9;
    overflow: hidden;
}

.admin-sidebar {
    width: 248px;
    flex: 0 0 248px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: calc(22px + var(--safe-area-top)) 14px 16px;
    box-sizing: border-box;
    background: #0f172a;
    color: #e2e8f0;
    overflow-y: auto;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 2px;
}

.admin-brand-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
}

.admin-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-brand-text strong {
    font-size: 15px;
    line-height: 1.3;
    color: #f8fafc;
}

.admin-brand-text span {
    margin-top: 2px;
    font-size: 11px;
    color: #94a3b8;
}

.admin-nav {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-nav-label {
    padding: 0 10px;
    font-size: 10.5px;
    letter-spacing: 0.16em;
    color: #64748b;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #cbd5e1;
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
    -webkit-tap-highlight-color: transparent;
}

.admin-nav-item svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    stroke-width: 1.8;
    opacity: 0.9;
}

.admin-nav-item:hover {
    background: rgba(148, 163, 184, 0.12);
    color: #f8fafc;
}

.admin-nav-item.active {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.admin-nav-item.active svg {
    opacity: 1;
}

.admin-sidebar-foot {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.admin-sidebar-note {
    display: block;
    padding: 0 10px;
    font-size: 11px;
    line-height: 1.6;
    color: #64748b;
}

.admin-workspace {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.admin-topbar-text h1 {
    margin: 0;
    font-size: 20px;
    line-height: 1.3;
    color: #0f172a;
}

.admin-topbar-text p {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: #64748b;
}

.admin-topbar-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-exit-btn {
    border-radius: 999px;
    padding: 8px 18px;
}

.admin-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 28px calc(48px + var(--safe-area-bottom));
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.admin-view {
    max-width: 1180px;
    margin: 0 auto;
}

.admin-view[hidden] {
    display: none !important;
}

.admin-view > .card:last-child {
    margin-bottom: 0;
}

.admin-log-tools-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.admin-log-tools-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 900px) {
    #admin-container {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        flex: 0 0 auto;
        height: auto;
        gap: 10px;
        padding: calc(12px + var(--safe-area-top)) 12px 10px;
        overflow: visible;
    }

    .admin-brand {
        padding: 0 2px;
    }

    .admin-brand-mark {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 10px;
        font-size: 12px;
    }

    .admin-brand-text strong {
        font-size: 14px;
    }

    .admin-brand-text span {
        display: none;
    }

    .admin-nav {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .admin-nav::-webkit-scrollbar {
        display: none;
    }

    .admin-nav-group {
        display: contents;
    }

    .admin-nav-label {
        display: none;
    }

    .admin-nav-item {
        width: auto;
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 12.5px;
        white-space: nowrap;
    }

    .admin-nav-item svg {
        width: 16px;
        height: 16px;
        flex-basis: 16px;
    }

    .admin-sidebar-foot {
        display: none;
    }

    .admin-workspace {
        height: auto;
        min-height: 0;
    }

    .admin-topbar {
        padding: 14px;
    }

    .admin-topbar-text h1 {
        font-size: 18px;
    }

    .admin-topbar-text p {
        display: none;
    }

    .admin-exit-btn {
        padding: 6px 14px;
    }

    .admin-content {
        padding: 14px 12px calc(32px + var(--safe-area-bottom));
    }

    .admin-view {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .admin-brand-text {
        display: none;
    }

    .admin-topbar {
        gap: 10px;
    }
}


/* ============ Telegram 发布卡片 & 管理端设置 ============ */
.task-item { isolation: isolate; }
.task-item > :not(.task-item-telegram-glow) { position: relative; z-index: 1; }
.task-item-telegram-glow {
    position: absolute;
    inset: -22%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(closest-side at 24% 20%, rgba(56, 189, 248, 0.55), transparent 72%),
        radial-gradient(closest-side at 76% 82%, rgba(168, 85, 247, 0.5), transparent 72%),
        radial-gradient(closest-side at 55% 42%, rgba(236, 72, 153, 0.34), transparent 70%);
    filter: blur(26px);
    transition: opacity 0.4s ease;
    animation: tgAuraFloat 5s ease-in-out infinite alternate;
}
.task-item.telegram-publishing {
    border: 2px solid transparent;
    background:
        linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) padding-box,
        linear-gradient(110deg, #38bdf8, #8b5cf6, #ec4899, #f59e0b, #38bdf8) border-box;
    background-size: 100% 100%, 320% 320%;
    animation: tgBorderFlow 3s linear infinite, tgGlowPulse 2.2s ease-in-out infinite;
}
.task-item.telegram-publishing .task-item-telegram-glow { opacity: 0.85; }
.task-item.telegram-just-sent { animation: tgSentFlash 1.6s ease-out; }

.task-item-head-right {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 0 0 auto;
}
.task-item-thumb {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
    flex: 0 0 auto;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
}
.task-item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.task-item-thumb-count {
    position: absolute;
    right: 3px;
    bottom: 3px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 999px;
    line-height: 1.4;
}

.task-tg-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.task-tg-badge.is-auto { background: #eef2ff; color: #4f46e5; border: 1px solid #c7d2fe; }
.task-tg-badge.is-sent { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.task-tg-badge.is-publishing { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.task-tg-badge.is-failed { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

.task-tg-panel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 14px 20px 0 24px;
    padding: 11px 12px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fbff, #f5f3ff);
    overflow: hidden;
    transition: background 0.3s ease, border-color 0.3s ease;
}
.task-tg-brand { display: flex; align-items: center; gap: 9px; flex: 1 1 180px; min-width: 0; }
.task-tg-brand-icon {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: #fff;
    flex: 0 0 auto;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.22);
}
.task-tg-brand-icon svg { width: 16px; height: 16px; }
.task-tg-brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.task-tg-brand-text strong { font-size: 12.5px; color: #334155; }
.task-tg-state {
    font-size: 11.5px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.task-tg-panel.is-sent .task-tg-state { color: #047857; }
.task-tg-panel.is-publishing .task-tg-state { color: #4f46e5; }
.task-tg-panel.is-failed .task-tg-state { color: #b91c1c; }

.task-tg-auto {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    color: #475569;
    padding: 4px 6px;
    border-radius: 999px;
}
.task-tg-auto-label { white-space: nowrap; }
.task-tg-switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; display: inline-block; }
.task-tg-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 2; }
.task-tg-switch input:disabled { cursor: not-allowed; }
.task-tg-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
}
.task-tg-slider::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.task-tg-switch input:checked + .task-tg-slider { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.task-tg-switch input:checked + .task-tg-slider::after { transform: translateX(16px); }
.task-tg-switch input:disabled + .task-tg-slider { opacity: 0.5; }

.task-tg-publish {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 14px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    overflow: hidden;
}
.task-tg-publish:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(79, 70, 229, 0.36); }
.task-tg-publish:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.task-tg-publish.is-loading {
    background: linear-gradient(135deg, #0ea5e9, #8b5cf6, #ec4899, #0ea5e9);
    background-size: 260% 260%;
    animation: tgButtonFlow 2s linear infinite;
}
.task-tg-orb {
    display: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #fff, #a5f3fc, #c4b5fd, #fbcfe8, #fef3c7, #fff);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.85);
    animation: tgOrbSpin 1.1s linear infinite;
}
.task-tg-publish.is-loading .task-tg-orb { display: inline-block; }
.task-tg-publish-text { white-space: nowrap; }

.task-item.telegram-just-sent .task-tg-panel {
    background: linear-gradient(135deg, #ecfdf5, #f0fdfa);
    border-color: #a7f3d0;
    animation: tgPanelFlash 0.9s ease-out;
}
.task-tg-panel::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid rgba(16, 185, 129, 0.7);
    opacity: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.task-item.telegram-just-sent .task-tg-panel::after { animation: tgBurst 1s ease-out; }

@keyframes tgBorderFlow {
    0% { background-position: 0 0, 0% 50%; }
    100% { background-position: 0 0, 300% 50%; }
}
@keyframes tgGlowPulse {
    0%, 100% { box-shadow: 0 10px 28px rgba(56, 189, 248, 0.24), 0 0 0 1px rgba(99, 102, 241, 0.12); }
    50% { box-shadow: 0 18px 52px rgba(168, 85, 247, 0.34), 0 0 0 1px rgba(99, 102, 241, 0.3); }
}
@keyframes tgAuraFloat {
    0% { transform: translate3d(-2%, -1%, 0) scale(0.98); }
    100% { transform: translate3d(2%, 2%, 0) scale(1.04); }
}
@keyframes tgButtonFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 260% 50%; }
}
@keyframes tgOrbSpin { to { transform: rotate(360deg); } }
@keyframes tgSentFlash {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55), 0 0 70px rgba(16, 185, 129, 0.5); }
    100% { box-shadow: 0 0 0 26px rgba(16, 185, 129, 0), 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes tgPanelFlash {
    0% { transform: scale(1); }
    40% { transform: scale(1.012); }
    100% { transform: scale(1); }
}
@keyframes tgBurst {
    0% { opacity: 0.85; width: 8px; height: 8px; }
    100% { opacity: 0; width: 340px; height: 340px; }
}

/* 管理端 Telegram 设置卡片 */
.telegram-settings-card { position: relative; overflow: hidden; border: 1px solid #dbeafe; }
.telegram-settings-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px 180px at 100% 0%, rgba(99, 102, 241, 0.10), transparent 70%),
        radial-gradient(400px 160px at 0% 100%, rgba(14, 165, 233, 0.08), transparent 70%);
    pointer-events: none;
}
.telegram-settings-card > * { position: relative; }
.telegram-settings-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.telegram-settings-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.telegram-settings-logo {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
    flex: 0 0 auto;
}
.telegram-settings-logo svg { width: 22px; height: 22px; }
.telegram-settings-sub { font-size: 13px; color: #64748b; }
.telegram-settings-desc { margin: 14px 0 0; font-size: 13px; color: #64748b; line-height: 1.75; }
.telegram-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.telegram-settings-hint { font-size: 12px; color: #94a3b8; margin-top: 6px; line-height: 1.5; }
.telegram-settings-hint a { color: #2563eb; text-decoration: none; }
.telegram-template-details { margin-top: 14px; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; background: #f8fafc; }
.telegram-template-details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: #475569; }
.telegram-template-details textarea { margin-top: 10px; }
.telegram-settings-options { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; }
.telegram-checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #475569; cursor: pointer; }
.telegram-checkbox input { transform: scale(1.15); }
.telegram-settings-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.telegram-test-result { font-size: 12.5px; color: #64748b; line-height: 1.5; }
.telegram-test-result.is-success { color: #047857; }
.telegram-test-result.is-error { color: #b91c1c; }
.telegram-test-result.is-pending { color: #4f46e5; }
.telegram-danger { color: #b91c1c !important; border-color: #fecaca !important; }
.telegram-chat-list { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.telegram-chat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
    padding: 9px 12px;
    border: 1px solid #dbeafe;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.telegram-chat-item:hover { border-color: #93c5fd; background: #f0f9ff; transform: translateY(-1px); }
.telegram-chat-item strong { font-size: 13px; color: #334155; }
.telegram-chat-item span { font-size: 12px; color: #64748b; word-break: break-all; }
.telegram-chat-empty { grid-column: 1 / -1; font-size: 12.5px; color: #94a3b8; padding: 10px 2px; }
.telegram-chat-empty.is-error { color: #b91c1c; }

@media (max-width: 760px) {
    .telegram-settings-grid { grid-template-columns: 1fr; }
    .task-item-head-right { width: 100%; justify-content: space-between; flex-direction: row-reverse; }
    .task-item-thumb { width: 52px; height: 52px; }
    .task-tg-panel { margin: 12px 16px 0 20px; padding: 10px; }
    .task-tg-brand { flex: 1 1 100%; }
    .task-tg-publish { margin-left: auto; }
}

/* 新版生图逻辑：上传图片卡片显示当前调用的 AI 模型 */
.pipeline-model-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    padding: 3px 9px 3px 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(14, 165, 233, 0.10));
    border: 1px solid rgba(99, 102, 241, 0.22);
    color: #4338ca;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0.01em;
    vertical-align: middle;
    white-space: nowrap;
}
.pipeline-model-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.55);
}
.pipeline-model-badge-ai {
    font-size: 8.5px;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    padding: 1px 5px;
    border-radius: 999px;
    line-height: 1.4;
}

/* Telegram 附加上传（发布时临时图片，发送后自动删除） */
.task-tg-extra-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px dashed #c7d2fe;
    border-radius: 999px;
    background: rgba(238, 242, 255, 0.65);
    color: #4f46e5;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.task-tg-extra-btn:hover:not(:disabled) {
    background: #eef2ff;
    border-color: #a5b4fc;
    transform: translateY(-1px);
}
.task-tg-extra-btn:disabled { opacity: 0.55; cursor: wait; }
.task-tg-extra-count {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}
.task-tg-extra-clear {
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 2px;
}
.task-tg-extra-clear:hover { color: #b91c1c; text-decoration: underline; }
