/* ===== Light Theme - 浅色主题 ===== */

body.light-theme {
    --bg-app: #ffffff;
    --bg-elevated: #ffffff;
    --bg-elevated-soft: #f8f9fa;
    --bg-card-border: rgba(0,0,0,0.1);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --primary: #2563eb;
    --primary-soft: rgba(37,99,235,0.1);
    --accent: #0ea5e9;
    --danger: #dc2626;
    background: #ffffff !important;

    /* Map Mode UI Tokens (Light) */
    --map-panel-bg: #ffffff;
    --map-panel-bg-strong: #ffffff;
    --map-panel-border: rgba(15,23,42,0.12);
    --map-panel-shadow: 0 14px 34px rgba(15,23,42,0.10);

    --map-card-bg: #ffffff;
    --map-card-border: rgba(15,23,42,0.10);

    --map-item-bg: #ffffff;
    --map-item-border: rgba(15,23,42,0.10);
    --map-item-hover-bg: rgba(37,99,235,0.08);
    --map-item-selected-bg: rgba(37,99,235,0.14);

    --map-stop-bg: #f8fafc;

    --map-select-bg: #ffffff;
    --map-select-border: rgba(15,23,42,0.16);
    --map-select-text: #111827;

    --map-accent: #2563eb;

    /* 小助手 /assistant：浅色下聊天区高对比（避免深底+深字） */
    --assistant-card-bg: #ffffff;
    --assistant-card-border: rgba(15,23,42,0.12);
    --assistant-chat-fg: #111827;
    --assistant-bubble-user-bg: #dbeafe;
    --assistant-bubble-user-fg: #0c1929;
    --assistant-bubble-user-border: rgba(37,99,235,0.4);
    /* 助手回复：与用户消息同色浅蓝气泡 */
    --assistant-bubble-assistant-bg: #dbeafe;
    --assistant-bubble-assistant-fg: #0c1929;
    --assistant-bubble-assistant-border: rgba(37,99,235,0.4);
    --assistant-input-bg: #ffffff;
    --assistant-input-border: rgba(15,23,42,0.2);
    --assistant-btn-bg: #f1f5f9;
    --assistant-btn-fg: #1e293b;
    --assistant-btn-border: rgba(15,23,42,0.14);
    --assistant-send-bg: #2563eb;
    --assistant-send-fg: #ffffff;
    --assistant-send-border: #1d4ed8;
}

body.light-theme a,
body.light-theme a:visited {
    color: #2563eb !important;
}

body.light-theme a:hover {
    color: #1d4ed8 !important;
}

body.light-theme .topbar {
    background: linear-gradient(90deg, #ffffff, #f8f9fa) !important;
    border-bottom: 1px solid rgba(0,0,0,0.1) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

body.light-theme .topbar-title-main,
body.light-theme .topbar-title-sub {
    color: #1f2937 !important;
}

body.light-theme .topbar-tag {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-color: rgba(0,0,0,0.1) !important;
}

body.light-theme .sidebar {
    background: linear-gradient(to bottom, #f8fafc, #eef2f7) !important;
    border-right: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.55) !important;
}

body.light-theme .sidebar-group-title {
    color: #64748b !important;
}

body.light-theme .nav-pill.active {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
    color: #1d4ed8 !important;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.14) !important;
}

body.light-theme .nav-pill.inactive {
    background: rgba(255, 255, 255, 0.88) !important;
    border-color: rgba(148, 163, 184, 0.32) !important;
    color: #475569 !important;
}

body.light-theme .nav-badge-dot {
    box-shadow: 0 0 0 2px #f8fafc, 0 0 10px rgba(239, 68, 68, 0.28) !important;
}

body.light-theme .table-shell {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
}

body.light-theme .orders-table thead tr {
    background: #f8f9fa !important;
}

body.light-theme .orders-table th {
    background: #f8f9fa !important;
    color: #374151 !important;
    border-bottom: 2px solid #d1d5db !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

body.light-theme .orders-table td {
    border-bottom: 1px solid #e5e7eb !important;
}

body.light-theme .orders-table td:not([style*="background-color"]):not([style*="backgroundColor"]) {
    background: #ffffff !important;
}

body.light-theme .orders-table td:not([style*="color"]) {
    color: #1f2937 !important;
}

body.light-theme .orders-table tbody tr.has-row-bg td,
body.light-theme .orders-table tbody tr[style*="background-color"] td {
    background-color: transparent !important;
}

body.light-theme .orders-table tbody tr:not(.has-row-bg):hover {
    background: #f3f4f6 !important;
}

body.light-theme .orders-table tbody tr:not(.has-row-bg):nth-child(even) {
    background: #fafafa !important;
}

body.light-theme .orders-table tbody tr:not(.has-row-bg):nth-child(even):hover {
    background: #f3f4f6 !important;
}

body.light-theme .cell-select {
    background: #ffffff !important;
    color: #1f2937 !important;
    border: 1px solid #d1d5db !important;
}

body.light-theme .cell-select:hover {
    background: #f9fafb !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 1px rgba(59,130,246,0.1) !important;
}

body.light-theme .cell-select:focus {
    background: #ffffff !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1) !important;
    outline: none !important;
}

body.light-theme .cell-select:disabled {
    background: #f3f4f6 !important;
    color: #9ca3af !important;
    border-color: #e5e7eb !important;
    cursor: not-allowed !important;
}

body.light-theme td[contenteditable="true"] {
    background: #ffffff !important;
    color: #1f2937 !important;
}

body.light-theme .theme-toggle-btn {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-color: rgba(0,0,0,0.1) !important;
}

body.light-theme .theme-toggle-btn:hover {
    background: #e2e8f0 !important;
    border-color: rgba(0,0,0,0.15) !important;
}

body.light-theme .topbar-date-form input[type="date"] {
    background: #f1f5f9 !important;
    color: #1f2937 !important;
    border-color: rgba(0,0,0,0.1) !important;
}

body.light-theme input,
body.light-theme textarea,
body.light-theme select {
    background: #ffffff !important;
    color: #1f2937 !important;
    border: 1px solid #d1d5db !important;
}

body.light-theme .table-scroll-indicator {
    background: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
}

body.light-theme .table-scroll-thumb {
    background: rgba(156,163,175,0.6) !important;
}

body.light-theme .table-scroll-thumb:hover {
    background: rgba(156,163,175,0.8) !important;
}

body.light-theme ::-webkit-scrollbar-track {
    background: #f3f4f6 !important;
}

body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(156,163,175,0.6) !important;
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(156,163,175,0.8) !important;
}

body.light-theme .btn-primary,
body.light-theme .btn-secondary {
    background: linear-gradient(135deg, #2563eb, #38bdf8) !important;
    color: #f9fafb !important;
    border: none !important;
    box-shadow: 0 14px 30px rgba(37,99,235,0.60) !important;
}

body.light-theme .btn-primary:hover,
body.light-theme .btn-secondary:hover {
    box-shadow: 0 18px 40px rgba(37,99,235,0.75) !important;
    transform: translateY(-0.5px);
}

/* 小助手：浅色下主卡片用柔和阴影，避免沿用深色页的强阴影 */
body.light-theme.page-assistant .assistant-card {
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08) !important;
}

/* 聊天滚动区：略浅于卡片，白底气泡轮廓更清晰 */
body.light-theme.page-assistant #chat {
    background: #f1f5f9 !important;
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
}

/* 助手消息气泡：再拉高对比与留白（报价长文本更易读） */
body.light-theme.page-assistant .msg.assistant .bubble {
    padding: 12px 14px !important;
    line-height: 1.65 !important;
    font-size: 13.5px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.07) !important;
}

/* ========== 外部询价 /external/quotes：浅色高对比 ========== */
body.light-theme.page-external-quotes .main {
    background: transparent !important;
}

body.light-theme.page-external-quotes .card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08) !important;
}

/* 左侧「客户标识 + 询价正文」：浅蓝底、深字、占位符可读（覆盖全局 input 白底规则） */
body.light-theme.page-external-quotes #customer_ref,
body.light-theme.page-external-quotes #quote_text {
    background: #dbeafe !important;
    color: #0c1929 !important;
    border: 1px solid #60a5fa !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

body.light-theme.page-external-quotes #customer_ref::placeholder,
body.light-theme.page-external-quotes #quote_text::placeholder {
    color: #475569 !important;
    opacity: 1 !important;
}

body.light-theme.page-external-quotes #customer_ref:focus,
body.light-theme.page-external-quotes #quote_text:focus {
    border-color: #2563eb !important;
    outline: 2px solid rgba(37, 99, 235, 0.28) !important;
    outline-offset: 1px !important;
}

/* 列表订单卡片：浅蓝底 + 正文统一深青黑（与小助手用户气泡一致） */
body.light-theme.page-external-quotes .item {
    background: #dbeafe !important;
    border-color: #93c5fd !important;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12) !important;
    color: #0c1929 !important;
}

body.light-theme.page-external-quotes .item .muted {
    color: #0c1929 !important;
}

body.light-theme.page-external-quotes .list > .muted {
    color: #475569 !important;
}

body.light-theme.page-external-quotes .item pre {
    color: #0c1929 !important;
    background: rgba(255, 255, 255, 0.82) !important;
    border: 1px solid #93c5fd !important;
    border-radius: 10px !important;
    padding: 10px 12px !important;
}

/* 元数据 pill：浅底；带行内 color 的状态标签仍保留黄/绿字 */
body.light-theme.page-external-quotes .item .pill {
    background: rgba(255, 255, 255, 0.6) !important;
    border-color: #93c5fd !important;
}

body.light-theme.page-external-quotes .item a.link {
    color: #0c1929 !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}

body.light-theme.page-external-quotes .item .btn-ext-secondary {
    color: #0c1929 !important;
    background: rgba(255, 255, 255, 0.78) !important;
    border-color: #93c5fd !important;
}

body.light-theme.page-external-quotes .item input[type="text"] {
    color: #0c1929 !important;
    border-color: #93c5fd !important;
}

body.light-theme.page-external-quotes .ext-tab-inactive {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

body.light-theme.page-external-quotes .ext-tab-active {
    background: #dbeafe !important;
    border-color: #3b82f6 !important;
    color: #1e40af !important;
}

body.light-theme.page-external-quotes .btn-ext-secondary {
    background: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

body.light-theme.page-external-quotes #btnCreate,
body.light-theme.page-external-quotes button[data-act="approve"],
body.light-theme.page-external-quotes button[data-oact="send"] {
    background: #2563eb !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
}

body.light-theme.page-external-quotes button[data-act="reject"],
body.light-theme.page-external-quotes button[data-oact="cancel"] {
    background: rgba(254, 226, 226, 0.95) !important;
    border-color: #f87171 !important;
    color: #991b1b !important;
}

/* 左侧「客户确认链接」等非卡片内链接仍可保持品牌蓝 */
body.light-theme.page-external-quotes #create_result a.link {
    color: #2563eb !important;
    text-decoration: none;
}
