/* v75 - Inquiries sub-tab optimization: level-1 blue bg, level-2 underline, type tags */
/* ============ Reset & Base ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #1967d2;
  --primary-dark: #0d47a1;
  --primary-light: #e8f0fe;
  --accent: #4285f4;
  --success: #137333;
  --success-bg: #e6f4ea;
  --warning: #e65100;
  --warning-bg: #fff3e0;
  --danger: #EF4444;
  --info: #3B82F6;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #8d9093;
  --gray-500: #5f6368;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #202124;
  --gray-900: #111827;
  --white: #FFFFFF;
  --page-bg: #f8f9fa;
  --border-color: #e8eaed;
  --radius: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --sidebar-w: 240px;
  /* CS Widget design tokens (v4.67) */
  --maya-brand: #1967d2;
  --maya-brand-hover: #0d47a1;
  --maya-brand-active: #0a3d8c;
  --maya-brand-light: #e8f0fe;
  --maya-brand-lighter: #f0f6ff;
  --on-brand: #FFFFFF;
  --surface: #FFFFFF;
  --border: #e8eaed;
  --border-soft: #f1f3f4;
  --placeholder: #9aa0a6;
  --offset-edge: 20px;
  --widget-width: 380px;
  --widget-height: 560px;
  --widget-width-with-sidebar: 660px;
  --z-launcher: 9998;
  --z-widget: 9999;
  --z-modal: 10001;
  --launcher-size: 56px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 9999px;
  --shadow-widget: 0 8px 32px rgba(0,0,0,0.18);
  --shadow-launcher: 0 4px 16px rgba(0,0,0,0.15);
  --shadow-modal: 0 20px 60px rgba(0,0,0,0.3);
  --focus-ring: 0 0 0 3px rgba(25,103,210,0.3);
  --motion-slow: 0.3s;
  --motion-fast: 0.15s;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-12: 48px;
  /* Typography */
  --text-caption: 12px;
  --text-small: 13px;
  --text-lg: 16px;
  --text-xl: 18px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* Semantic colors */
  --bg: #f8f9fa;
  --fg: #202124;
  --fg-tertiary: #80868b;
  --muted: #5f6368;
  --sidebar-width: 220px;
}
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--page-bg); color: var(--gray-800); font-size: 14px; line-height: 1.5; }

/* ============ Top Nav (60px, white, #e8eaed bottom border) ============ */
.top-nav { display: flex; justify-content: space-between; align-items: center; padding: 0 16px; height: 60px; background: var(--white); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; gap: 12px; }
.nav-brand { display: flex; align-items: center; gap: 8px; cursor: pointer; flex-shrink: 0; }
.logo-icon { font-size: 24px; }
.logo-text { font-size: 16px; font-weight: 600; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Customer zone in top nav: time + account + logout */
.nav-customer-zone { display: none; align-items: center; gap: 16px; flex: 1; justify-content: flex-end; }
.nav-clock-wrap { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.nav-clock { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.nav-date { font-size: 12px; color: var(--gray-400); }
.nav-user-badge { display: flex; align-items: center; gap: 8px; padding: 4px 12px; background: var(--gray-100); border-radius: var(--radius-sm); }
.nav-user-badge span:first-child { font-size: 13px; font-weight: 500; color: var(--gray-700); white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.nav-logout-btn { background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 8px; border-radius: 4px; }
.nav-logout-btn:hover { background: var(--primary-light); }

/* Brand Logo Images (Maya captain mascot) */
.brand-logo-img { display: inline-block; object-fit: contain; vertical-align: middle; }
.nav-logo-img { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.drawer-logo-img { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.auth-logo-img { width: 56px; height: 56px; border-radius: 50%; display: block; margin: 0 auto 8px; }
.welcome-logo-img { width: 72px; height: 72px; border-radius: 50%; margin-bottom: 12px; }
.admin-logo-img { width: 56px; height: 56px; border-radius: 50%; margin-bottom: 16px; }
.sidebar-logo-img { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.nav-actions { display: flex; gap: 8px; align-items: center; }
/* Language Dropdown Component */
.lang-dropdown { position: relative; display: inline-block; }
.lang-dropdown-btn { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-200); padding: 4px 12px; border-radius: 16px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 4px; transition: all 0.2s; }
.lang-dropdown-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.lang-dropdown-btn:active { background: var(--primary-light); }
.lang-dropdown-menu { display: none; position: absolute; top: 100%; right: 0; background: #fff; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 120px; z-index: 9999; overflow: hidden; }
[dir="rtl"] .lang-dropdown-menu { right: auto; left: 0; }
.lang-dropdown-menu.show { display: block; }
.lang-dropdown-item { display: block; width: 100%; padding: 8px 16px; border: none; background: none; text-align: left; cursor: pointer; font-size: 13px; color: var(--gray-800); transition: background 0.15s; }
[dir="rtl"] .lang-dropdown-item { text-align: right; }
.lang-dropdown-item:hover { background: var(--gray-100); }
.lang-dropdown-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }


/* PWA Install Button (nav bar) */
.nav-install-btn { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border: none; border-radius: 8px; background: linear-gradient(135deg, #1967d2, #4285f4); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; transition: all .2s; white-space: nowrap; box-shadow: 0 2px 8px rgba(25,103,210,.3); }
.nav-install-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(25,103,210,.4); }
.nav-install-btn:active { transform: translateY(0); }

/* Hamburger Button */
.hamburger-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: transparent; border: none; color: var(--gray-700); cursor: pointer; border-radius: 8px; transition: background 0.2s; flex-shrink: 0; font-size: 22px; line-height: 1; padding: 0; }
.hamburger-btn:hover { background: var(--gray-100); }
.hamburger-icon { display: inline-block; transition: transform 0.2s; }
.hamburger-btn.active { background: var(--primary); color: var(--white); }
.hamburger-btn.active .hamburger-icon { transform: rotate(90deg); }

/* Call button (right side of top nav) */
.call-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: var(--primary); border: none; color: var(--white); cursor: pointer; border-radius: 50%; transition: background 0.2s; font-size: 18px; padding: 0; }
.call-btn:hover { background: var(--primary-dark); }

/* Side Drawer */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 998; opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s; }
.drawer-overlay.open { opacity: 1; visibility: visible; }
.side-drawer { position: fixed; top: 0; left: 0; width: 280px; height: 100vh; background: var(--white); box-shadow: 4px 0 24px rgba(0,0,0,0.15); z-index: 999; transform: translateX(-100%); transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; }
.side-drawer.open { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; border-bottom: 1px solid var(--gray-200); background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: var(--white); }
.drawer-logo { font-size: 28px; }
.drawer-title { font-size: 16px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-close { background: rgba(255,255,255,0.2); border: none; color: var(--white); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.drawer-close:hover { background: rgba(255,255,255,0.35); }
.drawer-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.drawer-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; background: transparent; border: none; color: var(--gray-700); font-size: 14px; font-weight: 500; cursor: pointer; border-radius: 10px; transition: all 0.2s; text-align: left; margin-bottom: 4px; }
.drawer-item:hover { background: var(--gray-100); color: var(--primary); }
.drawer-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.drawer-item.active .drawer-icon { transform: scale(1.15); }
.drawer-icon { font-size: 18px; width: 24px; text-align: center; transition: transform 0.2s; }
.drawer-label { flex: 1; }
.drawer-footer { padding: 12px 8px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }
.drawer-lang { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); font-size: 14px; font-weight: 500; cursor: pointer; border-radius: 10px; transition: all 0.2s; text-align: left; margin-bottom: 4px; }
.drawer-lang:hover { background: var(--white); border-color: var(--primary); color: var(--primary); }

/* ============ Views ============ */
.view { display: none; }
.view.active { display: block; }

/* ============ Customer View — Left 35% Chat + Right 65% Work Panel ============ */
.customer-layout { display: flex; gap: 16px; padding: 16px; max-width: 1400px; margin: 0 auto; align-items: stretch; height: calc(100vh - 60px); }

/* ===== Left Column: Chat Panel (35%) ===== */
.chat-panel { width: 35%; min-width: 320px; max-width: 520px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
/* Blue header */
.chat-panel-header { background: var(--primary); color: var(--white); padding: 16px 20px; border-radius: var(--radius) var(--radius) 0 0; }
.chat-panel-title { font-size: 16px; font-weight: 600; }
.chat-panel-status { display: flex; align-items: center; gap: 6px; font-size: 11px; opacity: 0.85; margin-top: 4px; }
.chat-panel-status .status-dot { width: 6px; height: 6px; }

/* Chat panel body */
.chat-panel-body { position: relative; flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Client Auth Overlay */
.client-auth-overlay { position: absolute; inset: 0; background: var(--page-bg); z-index: 50; overflow-y: auto; padding: 16px; }
.client-auth-card { max-width: 340px; margin: 8px auto; background: var(--white); border-radius: var(--radius); padding: 24px 20px; box-shadow: var(--shadow); }
.auth-form-box { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.auth-form-box .form-row { display: flex; gap: 10px; }
.auth-form-box .form-row .form-item { flex: 1; }
.auth-form-box .form-item label { font-size: 12px; font-weight: 600; color: var(--gray-500); display: block; margin-bottom: 4px; }
.auth-form-box .form-item input { width: 100%; padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; box-sizing: border-box; }
.auth-form-box .form-item input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(25,103,210,0.12); }
.auth-btn { margin-top: 6px; width: 100%; }
.company-type-select { display: flex; flex-direction: column; gap: 8px; }
.company-type-option { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; transition: all 0.2s; }
.company-type-option:hover { border-color: var(--primary); }
.company-type-option input[type=radio] { accent-color: var(--primary); }
.auth-switch { text-align: center; font-size: 12px; color: var(--gray-400); margin: 4px 0 0; }
.btn-link { background: none; border: none; color: var(--primary); font-size: 13px; cursor: pointer; text-decoration: underline; padding: 4px; }
.client-auth-sub { text-align: center; font-size: 12px; color: var(--gray-400); margin-bottom: 4px; }

/* Terms agreement checkbox */
.terms-agree-row { margin-top: 4px; }
.terms-checkbox-label { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--gray-500); cursor: pointer; line-height: 1.5; }
.terms-checkbox-label input[type=checkbox] { margin-top: 2px; accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }
.terms-link { color: var(--primary); text-decoration: underline; font-weight: 500; }
.terms-link:hover { text-decoration: none; opacity: 0.8; }

/* Chat area */
.chat-area { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-welcome { text-align: center; padding: 24px 8px; }
.welcome-logo-img { width: 72px; height: 72px; border-radius: 50%; margin-bottom: 12px; }
.welcome-text { font-size: 13px; color: var(--gray-500); line-height: 1.5; margin-bottom: 16px; }
.quick-tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.quick-tag { padding: 9px 18px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; transition: all 0.2s; font-weight: 500; }
.quick-tag.primary { background: var(--primary); color: var(--white); border: 1px solid var(--primary); }
.quick-tag.primary:hover { background: var(--primary-dark); }
.quick-tag.secondary { background: var(--white); border: 1px solid var(--primary); color: var(--primary); }
.quick-tag.secondary:hover { background: var(--primary-light); }
.quick-tag.tertiary { background: #e8f0fe; border: 1px solid #1967d2; color: #1967d2; }
.quick-tag.tertiary:hover { background: #d2e3fc; }
.quick-tag.quaternary { background: #fef7e0; border: 1px solid #f9ab00; color: #b06000; }
.quick-tag.quaternary:hover { background: #fef0c7; }

/* Sub-tab navigation for merged Inquiries & Quotes */
.ctab-subnav { display: flex; gap: 0; border-bottom: 1px solid #e8eaed; padding: 0; flex-shrink: 0; }
.ctab-sub { padding: 7px 14px; border: none; background: none; cursor: pointer; font-size: 12px; font-weight: 500; color: var(--gray-500); border-bottom: 2px solid transparent; transition: all .2s; white-space: nowrap; }
.ctab-sub:hover { color: var(--gray-700); }
.ctab-sub.active { color: var(--primary); border-bottom-color: var(--primary); }
.ctab-subpanel { display: none; flex: 1; min-height: 0; overflow-y: auto; flex-direction: column; }
.ctab-subpanel.active { display: flex; }

/* Inquiry type tag badges */
.inq-type-tag { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 700; white-space: nowrap; margin-right: 4px; vertical-align: middle; }
.inq-type-tag.rfq { background: #e8f0fe; color: #1967d2; }
.inq-type-tag.si { background: #fef7e0; color: #b06000; }
.inq-type-tag.ts { background: #fce8e6; color: #c5221f; }

/* SI Form Styles */
.si-form-section { background:#f8f9fa; border-radius:8px; padding:12px 14px; margin-bottom:12px; }
.si-form-section-title { font-weight:700; font-size:13px; color:#1967d2; margin-bottom:10px; padding-bottom:6px; border-bottom:1px solid #e8eaed; }
.si-hint { font-size:11px; color:#5f6368; margin-top:3px; line-height:1.4; }
.si-radio-group { display:flex; flex-direction:column; gap:6px; margin-top:4px; }
.si-radio-label { display:flex; align-items:center; gap:6px; font-size:12px; cursor:pointer; padding:4px 8px; border-radius:4px; transition:background 0.15s; }
.si-radio-label:hover { background:#e8f0fe; }
.si-radio-label input[type="radio"] { accent-color:#1967d2; width:14px; height:14px; cursor:pointer; }

/* Chat Messages */
.msg { max-width: 80%; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; animation: msgIn 0.3s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.msg.user { align-self: flex-end; background: var(--primary); color: var(--white); border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--white); color: var(--gray-800); border: 1px solid var(--gray-200); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.msg.typing { align-self: flex-start; background: var(--white); color: var(--gray-400); font-style: italic; }
.msg.ai .product-tag { display: inline-block; background: var(--primary-light); color: var(--primary); padding: 2px 8px; border-radius: 4px; font-size: 11px; margin: 2px; font-weight: 600; }
.msg.ai .stock-ok { color: var(--success); font-weight: 600; }
.msg.ai .stock-low { color: var(--warning); font-weight: 600; }
.msg.ai .stock-out { color: var(--danger); font-weight: 600; }
.msg.ai .action-btn { display: inline-block; margin-top: 8px; padding: 6px 16px; background: var(--primary); color: var(--white); border: none; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; }
.msg.ai .action-btn:hover { background: var(--primary-dark); }

/* Chat Input (height 48px, radius 8px) */
.chat-input-area { padding: 12px 14px; border-top: 1px solid var(--border-color); background: var(--white); }
.chat-input-row { display: flex; gap: 8px; align-items: center; }
.chat-input { flex: 1; height: 52px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); padding: 0 16px; font-size: 14px; outline: none; transition: border-color 0.2s; box-sizing: border-box; color: var(--gray-800); }
.chat-input::placeholder { color: #bdc1c6; }
.chat-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(25,103,210,0.1); }
.chat-btn-icon { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; height: 52px; display: flex; align-items: center; }
.chat-btn-send { height: 52px; background: var(--primary); color: var(--white); border: none; border-radius: var(--radius-sm); padding: 0 24px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.chat-btn-send:hover { background: var(--primary-dark); }

/* ===== Right Column: Work Panel (65%) ===== */
.work-panel { flex: 1; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.work-section { padding: 16px; overflow-y: auto; flex: 1; min-height: 0; }
.work-section-title { font-size: 16px; font-weight: 600; color: var(--gray-800); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); position: sticky; top: -16px; background: var(--white); margin: -16px -16px 12px; padding: 16px 16px 8px; z-index: 1; }
.work-divider { height: 1px; background: var(--border-color); margin: 0; }

/* Lightweight scrollbar */
.work-section::-webkit-scrollbar { width: 6px; }
.work-section::-webkit-scrollbar-track { background: transparent; }
.work-section::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 3px; }
.work-section::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }
.chat-area::-webkit-scrollbar { width: 6px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 3px; }
.chat-area::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

/* Status dot & empty states */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: #34a853; box-shadow: 0 0 4px #34a853; }
.inquiry-summary.empty, .quote-list .empty-state { text-align: center; padding: 24px; }
.empty-icon { font-size: 32px; display: block; margin-bottom: 8px; opacity: 0.4; }
.empty-state p { color: var(--gray-400); font-size: 13px; }

/* Inquiry cards — card-style, hover #f1f3f4 */
.inquiry-card { padding: 10px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; transition: all 0.2s; background: var(--white); }
.inquiry-card:hover { background: #f1f3f4; border-color: var(--gray-300); }
.inquiry-card-active { border-left: 3px solid var(--primary); }
.inquiry-card-info { border-style: dashed; cursor: default; }
.inquiry-card-info:hover { background: var(--white); border-color: var(--border-color); }
.inquiry-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.inquiry-card-id { font-weight: 600; color: var(--primary); font-size: 13px; }
.inquiry-card-count { font-weight: 500; font-size: 12px; color: var(--gray-400); }
.inquiry-card-sub { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.inquiry-card-name { font-weight: 500; font-size: 13px; color: var(--gray-800); }
.inquiry-card-qty { display: inline-block; background: var(--primary-light); color: var(--primary); padding: 1px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.inquiry-card-detail { font-size: 12px; color: var(--gray-500); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inquiry-card-brand { font-weight: 600; color: var(--gray-700); }
.inquiry-card-partno { font-family: monospace; font-size: 11px; }
.inquiry-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

/* Quote cards — 3-column layout: ID left, status center, amount right */
.quote-card { padding: 10px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; transition: all 0.2s; background: var(--white); }
.quote-card:hover { background: #f1f3f4; border-color: var(--gray-300); }
.quote-card-header { display: flex; justify-content: space-between; align-items: center; }
.quote-card-id { font-weight: 600; color: var(--primary); font-size: 13px; flex: 0 0 auto; }
.quote-card-status-wrap { flex: 1; display: flex; justify-content: center; }
.quote-card-amount { font-weight: 700; font-size: 15px; color: var(--gray-800); text-align: right; flex: 0 0 auto; }
.quote-card-customer { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* Status badges — compact, 6px radius */
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.badge-high { background: #e6f4ea; color: #137333; }
.badge-medium { background: #fff3e0; color: #e65100; }
.badge-low { background: #fee2e2; color: #c5221f; }
.badge-pending { background: #fff3e0; color: #e65100; }
.badge-reviewing { background: #fff3e0; color: #e65100; }
.badge-quoted { background: #e8f0fe; color: #1967d2; }
.badge-ordered { background: #e6f4ea; color: #137333; }
.badge-closed { background: #f1f3f4; color: #5f6368; }
.badge-rejected { background: #fee2e2; color: #c5221f; }
.badge-sent { background: #e8f0fe; color: #1967d2; }
.badge-accepted { background: #e6f4ea; color: #137333; }
.badge-draft { background: #f1f3f4; color: #5f6368; }
.badge-expired { background: #fee2e2; color: #c5221f; }

/* ============ Admin Login ============ */
.login-screen { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 60px); background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
.login-card { background: var(--white); border-radius: var(--radius); padding: 40px; width: 400px; text-align: center; box-shadow: var(--shadow-lg); }
.login-logo { font-size: 48px; margin-bottom: 16px; }
.login-card h2 { font-size: 20px; color: var(--gray-800); margin-bottom: 4px; }
.login-sub { color: var(--gray-400); font-size: 13px; margin-bottom: 24px; }
.login-form { text-align: left; }
.login-form label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; margin-top: 12px; }
.login-select, .login-input { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 14px; outline: none; transition: border-color 0.2s; }
.login-select:focus, .login-input:focus { border-color: var(--primary); }
.login-form .btn-primary { width: 100%; margin-top: 20px; }
.login-hint { text-align: center; font-size: 12px; color: var(--gray-400); margin-top: 12px; }

/* ============ Admin Dashboard ============ */
.admin-dashboard { display: flex; min-height: calc(100vh - 60px); }
.sidebar { width: var(--sidebar-w); background: var(--gray-900); color: var(--white); display: flex; flex-direction: column; position: sticky; top: 60px; height: calc(100vh - 60px); }
.sidebar-header { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-header .sidebar-logo-img { width: 36px; height: 36px; border-radius: 50%; }
.sidebar-title { font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.9); letter-spacing: 0.3px; }
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 20px;
  color: rgba(255,255,255,0.6); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: all 0.18s; cursor: pointer; position: relative; line-height: 1.4;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.9); }
.nav-item.active {
  background: rgba(25,103,210,0.12); color: #fff;
  border-left: 3px solid #1967d2;
  font-weight: 600;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-icon { font-size: 16px; width: 22px; text-align: center; opacity: 0.8; line-height: 1; flex-shrink: 0; }
.nav-badge {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: #ea1741; color: #fff; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 10px; min-width: 16px; height: 16px;
  text-align: center; line-height: 14px; box-shadow: 0 0 0 2px var(--gray-900);
}
.nav-badge.review { background: var(--warning); }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.08); margin-top: auto; }
.user-info { font-size: 11px; color: rgba(255,255,255,0.5); margin-bottom: 6px; line-height: 1.5; }
.btn-logout { width: 100%; padding: 7px; background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; transition: all 0.15s; }
.btn-logout:hover { background: rgba(255,255,255,0.12); color: #fff; }

.admin-main { flex: 1; padding: 24px; overflow-y: auto; }
.admin-page { display: none; }
.admin-page.active { display: block; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--gray-800); }
.page-sub { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* Stat Cards */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.stat-icon.blue { background: #DBEAFE; }
.stat-icon.green { background: #e6f4ea; }
.stat-icon.orange { background: #fff3e0; }
.stat-icon.purple { background: #EDE9FE; }
.stat-info h4 { font-size: 24px; font-weight: 800; color: var(--gray-800); }
.stat-info p { font-size: 12px; color: var(--gray-500); }

/* Charts */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.chart-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.chart-card.large { grid-column: span 2; }
.chart-card h3 { font-size: 14px; font-weight: 700; color: var(--gray-700); margin-bottom: 12px; }
.chart-card canvas { max-height: 280px; }

/* Tables */
.table-container { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--gray-50); padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); font-size: 13px; color: var(--gray-700); }
.data-table tr:hover { background: var(--gray-50); }
.data-table tr:last-child td { border-bottom: none; }

/* Review cards */
.review-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; }
.review-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border-left: 4px solid var(--warning); }
.review-card-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 12px; }
.review-card-id { font-weight: 700; color: var(--primary); }
.review-reason { background: #fff3e0; color: #e65100; padding: 4px 10px; border-radius: var(--radius-xs); font-size: 12px; margin: 4px 0; }
.review-items { margin: 12px 0; }
.review-item { padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.review-item-name { font-weight: 600; font-size: 13px; }
.review-item-detail { font-size: 12px; color: var(--gray-500); }
.review-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Buttons */
.btn-primary { background: var(--primary); color: var(--white); border: none; border-radius: var(--radius-sm); padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; border: 1px solid var(--gray-300); background: var(--white); cursor: pointer; }
.btn-sm:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: var(--white); border: none; border-radius: var(--radius-sm); padding: 8px 16px; font-size: 13px; cursor: pointer; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: var(--white); border: none; border-radius: var(--radius-sm); padding: 8px 16px; font-size: 13px; cursor: pointer; }
.btn-danger:hover { opacity: 0.9; }
.btn-warning { background: var(--warning); color: var(--white); border: none; border-radius: var(--radius-sm); padding: 8px 16px; font-size: 13px; cursor: pointer; }
.btn-warning:hover { opacity: 0.9; }

/* Filter selects */
.filter-select { padding: 6px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 13px; outline: none; cursor: pointer; }

/* Settings */
.settings-container { display: flex; flex-direction: column; gap: 24px; max-width: 800px; }
.settings-section { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.settings-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--gray-800); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.setting-item { display: flex; flex-direction: column; gap: 4px; }
.setting-item label { font-size: 12px; color: var(--gray-600); font-weight: 600; }
.setting-item input { padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; outline: none; }
.setting-item input:focus { border-color: var(--primary); }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; justify-content: center; align-items: center; }
.modal-content { background: var(--white); border-radius: var(--radius); width: 500px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-content.large { width: 800px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--gray-200); }
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-400); }
.modal-close:hover { color: var(--gray-600); }
.modal-body { padding: 24px; }

/* Email form */
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 5px; }
.form-input { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; box-sizing: border-box; transition: border-color .2s; }
.form-input:focus { outline: none; border-color: var(--primary); }
.form-textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; box-sizing: border-box; resize: vertical; font-family: inherit; }
.form-textarea:focus { outline: none; border-color: var(--primary); }

/* Quote detail */
.quote-detail-section { margin-bottom: 20px; }
.quote-detail-section h4 { font-size: 14px; font-weight: 700; color: var(--gray-700); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--gray-200); }
.quote-detail-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.quote-detail-row .label { color: var(--gray-500); }
.quote-detail-row .value { font-weight: 600; color: var(--gray-800); }
.quote-items-table { width: 100%; margin: 8px 0; }
.quote-items-table th, .quote-items-table td { padding: 6px 8px; font-size: 12px; text-align: left; border-bottom: 1px solid var(--gray-100); }
.quote-items-table th { font-weight: 700; color: var(--gray-600); background: var(--gray-50); }
.quote-total-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 15px; font-weight: 700; color: var(--primary); border-top: 2px solid var(--primary); margin-top: 8px; }

/* ===== Inquiry List Cards ===== */
.inquiry-card-list { display: flex; flex-direction: column; gap: 12px; }
.inquiry-list-card {
  background: #fff; border: 1px solid #e8eaed; border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06); transition: all 0.2s; overflow: hidden;
}
.inquiry-list-card:hover { border-color: #c4d7f5; box-shadow: 0 2px 12px rgba(25,103,210,0.08); }
.inquiry-list-card-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid #f1f3f4;
}
.inquiry-list-card-header .ilc-id { font-size: 14px; font-weight: 700; color: #202124; white-space: nowrap; }
.inquiry-list-card-header .ilc-customer { font-size: 13px; color: #5f6368; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inquiry-list-card-header .ilc-date { font-size: 12px; color: #8d9093; white-space: nowrap; }
.inquiry-list-card-body { padding: 10px 16px; }
.inquiry-list-card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.inquiry-list-card-tags .badge { font-size: 10px; padding: 2px 8px; }
.inquiry-list-card-port { font-size: 12px; color: #8d9093; display: flex; align-items: center; gap: 4px; }
.inquiry-list-card-port .port-icon { font-size: 13px; }

/* Collapsible parts section */
.ilc-parts-toggle {
  display: flex; align-items: center; gap: 6px; padding: 6px 0;
  cursor: pointer; font-size: 12px; color: #1967d2; font-weight: 600;
  user-select: none; transition: color 0.15s;
}
.ilc-parts-toggle:hover { color: #1557b8; }
.ilc-parts-toggle .toggle-arrow { font-size: 10px; transition: transform 0.2s; }
.ilc-parts-toggle.expanded .toggle-arrow { transform: rotate(90deg); }
.ilc-parts-toggle .parts-count { color: #8d9093; font-weight: 400; margin-left: 4px; }

.ilc-parts-container {
  max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
}
.ilc-parts-container.expanded { max-height: 600px; }
.ilc-parts-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px;
  padding: 8px 0 4px;
}
.ilc-part-item {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  border-radius: 6px; font-size: 12px; transition: background 0.15s;
}
.ilc-part-item:hover { background: #f1f3f4; }
.ilc-part-item .pip-partno { font-family: 'Courier New', monospace; color: #1967d2; font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-decoration-color: #c4d7f5; }
.ilc-part-item .pip-partno:hover { text-decoration-color: #1967d2; }
.ilc-part-item .pip-qty { color: #8d9093; font-size: 11px; white-space: nowrap; }

/* Inquiry card footer */
.inquiry-list-card-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 8px 16px; border-top: 1px solid #f1f3f4; background: #fafbfc;
}
.ilc-action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.15s; white-space: nowrap;
}
.ilc-action-btn.detail { background: #fff; color: #1967d2; border: 1px solid #1967d2; }
.ilc-action-btn.detail:hover { background: #e8f0fe; }
.ilc-action-btn.quote { background: #1967d2; color: #fff; }
.ilc-action-btn.quote:hover { background: #1557b8; box-shadow: 0 2px 6px rgba(25,103,210,0.25); }
.ilc-action-btn.quote:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.ilc-action-btn.assign { background: #fff; color: #5f6368; border: 1px solid #dadce0; }
.ilc-action-btn.assign:hover { background: #f1f3f4; border-color: #bdc1c6; }

/* Inquiry page toolbar */
.inquiry-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
  flex-wrap: wrap;
}
.inquiry-search-box {
  position: relative; flex: 1; min-width: 200px;
}
.inquiry-search-box input {
  width: 100%; padding: 8px 12px 8px 36px; border: 1px solid #dadce0;
  border-radius: 8px; font-size: 13px; outline: none; transition: border-color 0.2s;
  background: #fff; box-sizing: border-box;
}
.inquiry-search-box input:focus { border-color: #1967d2; box-shadow: 0 0 0 2px rgba(25,103,210,0.1); }
.inquiry-search-box .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: #8d9093; pointer-events: none;
}
.inquiry-filter-select {
  padding: 8px 12px; border: 1px solid #dadce0; border-radius: 8px;
  font-size: 13px; outline: none; cursor: pointer; background: #fff; color: #202124;
  transition: border-color 0.2s;
}
.inquiry-filter-select:focus { border-color: #1967d2; }

/* ===== Inquiry Detail Side Drawer ===== */
.inquiry-drawer-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.35); z-index: 999; display: none; }
.inquiry-drawer-overlay.open { display: block; }
.inquiry-drawer {
  position: fixed; top: 0; right: -560px; width: 560px; max-width: 92vw; height: 100vh;
  background: var(--white); box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 1001; transition: right 0.3s ease; display: flex; flex-direction: column;
}
.inquiry-drawer.open { right: 0; }
.inquiry-drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; border-bottom: 1px solid rgba(255,255,255,0.15);
  background: linear-gradient(135deg, #1967d2, #4285f4); color: #fff;
}
.inquiry-drawer-header h3 { font-size: 16px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.inquiry-drawer-header .drawer-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #fff; opacity: 0.85; line-height: 1; }
.inquiry-drawer-header .drawer-close:hover { opacity: 1; }
.inquiry-drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* Drawer info grid */
.idrawer-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-bottom: 20px; }
.idrawer-info-item { display: flex; flex-direction: column; gap: 2px; }
.idrawer-info-item .iil { font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.3px; }
.idrawer-info-item .iiv { font-size: 14px; font-weight: 600; color: var(--gray-800); }

/* Smart classification groups */
.item-cat-group { margin-bottom: 16px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); overflow: hidden; }
.item-cat-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: #f8f9fa; cursor: pointer; user-select: none; transition: background 0.15s;
}
.item-cat-header:hover { background: #f1f3f4; }
.item-cat-header .cat-icon { font-size: 18px; }
.item-cat-header .cat-name { font-size: 13px; font-weight: 700; color: var(--gray-700); flex: 1; }
.item-cat-header .cat-count { font-size: 11px; color: var(--gray-400); background: #fff; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--gray-200); }
.item-cat-header .cat-toggle { font-size: 12px; color: var(--gray-400); transition: transform 0.2s; }
.item-cat-group.collapsed .cat-toggle { transform: rotate(-90deg); }
.item-cat-group.collapsed .item-cat-body { display: none; }
.item-cat-body { padding: 0; }
.item-cat-body table { width: 100%; }
.item-cat-body th, .item-cat-body td { padding: 6px 10px; font-size: 12px; text-align: left; border-bottom: 1px solid var(--gray-100); }
.item-cat-body th { font-weight: 600; color: var(--gray-500); background: #fafbfc; }
.item-cat-body td.partno { font-family: monospace; font-size: 11px; color: var(--primary); cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-decoration-color: var(--gray-300); }
.item-cat-body td.partno:hover { text-decoration-color: var(--primary); }

/* Drawer quick action footer */
.inquiry-drawer-footer {
  padding: 12px 24px; border-top: 1px solid var(--gray-200);
  display: flex; gap: 10px; justify-content: flex-end; background: #fafbfc;
}
.inquiry-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s;
}
.inquiry-action-btn.primary { background: var(--primary); color: #fff; }
.inquiry-action-btn.primary:hover { background: #1557b8; box-shadow: 0 2px 8px rgba(25,103,210,0.3); }
.inquiry-action-btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.inquiry-action-btn.secondary:hover { background: #e8f0fe; }
.inquiry-action-btn.success { background: var(--success); color: #fff; }
.inquiry-action-btn.success:hover { background: #0f5d2a; }

/* Quick action buttons in table rows */
.inquiry-row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.inquiry-row-actions .btn-mini {
  padding: 3px 10px; border-radius: 5px; font-size: 11px; font-weight: 600;
  border: none; cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.inquiry-row-actions .btn-mini.quote { background: var(--primary); color: #fff; }
.inquiry-row-actions .btn-mini.quote:hover { background: #1557b8; }
.inquiry-row-actions .btn-mini.assign { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.inquiry-row-actions .btn-mini.assign:hover { background: #e8f0fe; }
.inquiry-row-actions .btn-mini.detail { background: #fff; color: var(--gray-600); border: 1px solid var(--gray-300); }
.inquiry-row-actions .btn-mini.detail:hover { background: #f1f3f4; }

/* Assign salesperson mini modal */
.assign-modal-content { padding: 20px; }
.assign-modal-content p { font-size: 13px; color: var(--gray-500); margin-bottom: 12px; }
.assign-employee-list { display: flex; flex-direction: column; gap: 6px; }
.assign-employee-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s;
}
.assign-employee-option:hover { border-color: var(--primary); background: #e8f0fe; }
.assign-employee-option.selected { border-color: var(--primary); background: #e8f0fe; }
.assign-employee-option .emp-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.assign-employee-option .emp-info { flex: 1; }
.assign-employee-option .emp-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.assign-employee-option .emp-role { font-size: 11px; color: var(--gray-400); }

/* Pagination */
.inquiry-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; gap: 12px; flex-wrap: wrap;
}
.inquiry-pagination-info { font-size: 12px; color: var(--gray-400); }
.inquiry-pagination-controls { display: flex; align-items: center; gap: 4px; }
.inquiry-pagination-controls .pg-btn {
  min-width: 32px; height: 32px; border: 1px solid var(--gray-200); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 12px; color: var(--gray-600); transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; padding: 0 8px;
}
.inquiry-pagination-controls .pg-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: #e8f0fe; }
.inquiry-pagination-controls .pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.inquiry-pagination-controls .pg-btn:disabled { opacity: 0.4; cursor: default; }
.inquiry-pagination-controls .pg-size-select {
  padding: 4px 8px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 12px; color: var(--gray-600);
  background: #fff; cursor: pointer; outline: none;
}
.inquiry-pagination-controls .pg-size-select:focus { border-color: var(--primary); }

/* ===== Professional Quotation Template (matching PDF) ===== */
.qt-doc { font-family: 'Segoe UI', Arial, sans-serif; color: #222; max-width: 700px; margin: 0 auto; }
.qt-header { text-align: left; margin-bottom: 4px; }
.qt-company-name { font-size: 18px; font-weight: 700; color: #111; }
.qt-company-addr { font-size: 10px; color: #666; line-height: 1.5; }
.qt-title { font-size: 24px; font-weight: 700; text-align: center; margin: 12px 0; letter-spacing: 2px; }
.qt-info-grid { display: flex; gap: 20px; margin-bottom: 12px; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; padding: 10px 0; }
.qt-info-col { flex: 1; }
.qt-info-row { display: flex; font-size: 11px; padding: 2px 0; }
.qt-info-label { font-weight: 700; color: #555; min-width: 80px; }
.qt-info-val { color: #222; font-weight: 500; }
.qt-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-bottom: 8px; }
.qt-table thead th { background: #282828; color: #fff; padding: 6px 4px; text-align: center; font-weight: 700; font-size: 10px; }
.qt-table tbody td { padding: 5px 4px; border-bottom: 1px solid #eee; color: #333; }
.qt-table tbody tr:nth-child(even) { background: #f7f7f7; }
.qt-col-no { width: 28px; text-align: center; }
.qt-col-desc { text-align: left; }
.qt-col-part { text-align: left; font-family: monospace; font-size: 10px; }
.qt-col-merchant { text-align: center; font-family: monospace; font-size: 10px; white-space: nowrap; }
.qt-col-price { text-align: right; }
.qt-col-qty { text-align: center; width: 36px; }
.qt-col-unit { text-align: center; width: 40px; }
.qt-col-amt { text-align: right; font-weight: 600; }
.qt-right { text-align: right; }
.qt-center { text-align: center; }
.qt-summary { margin-left: auto; width: 260px; margin-bottom: 16px; }
.qt-sum-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 11px; color: #555; border-bottom: 1px solid #f0f0f0; }
.qt-sum-total { font-size: 14px; font-weight: 700; color: #111; background: #282828; color: #fff; padding: 6px 10px; border-radius: 3px; margin-top: 4px; border: none; }
.qt-terms { font-size: 10px; color: #555; margin-bottom: 10px; }
.qt-terms-title { font-weight: 700; font-size: 11px; color: #111; margin-bottom: 4px; }
.qt-term-item { padding: 1px 0; line-height: 1.5; }
.qt-contact { font-size: 10px; color: #555; padding: 8px 0; border-top: 1px solid #ddd; }
.qt-thankyou { font-size: 14px; font-weight: 700; text-align: center; margin-top: 12px; color: #111; }
.qt-ai-note { font-size: 9px; font-style: italic; text-align: center; color: #aaa; margin-top: 4px; }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--gray-800); color: var(--white); padding: 12px 24px; border-radius: var(--radius-sm); font-size: 14px; z-index: 2000; animation: toastIn 0.3s ease; box-shadow: var(--shadow-lg); }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============ Mobile Responsive ============ */
.mobile-sidebar-toggle { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 1024px) {
  .customer-layout { flex-direction: column; height: auto; }
  .chat-panel { width: 100%; max-width: none; min-width: 0; max-height: 55vh; }
  .work-panel { min-height: 400px; }
  .chart-card.large { grid-column: span 1; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .merchant-cat-select-group { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Admin sidebar → slide-in drawer */
  .sidebar {
    position: fixed; top: 60px; left: 0; z-index: 200;
    width: 260px; height: calc(100vh - 60px);
    transform: translateX(-100%); transition: transform 0.3s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; top: 60px; left: 0; width: 100%; height: calc(100vh - 60px);
    background: rgba(0,0,0,0.4); z-index: 199; display: none;
  }
  .sidebar-overlay.show { display: block; }
  .mobile-sidebar-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; background: var(--primary); color: #fff;
    border: none; border-radius: var(--radius-sm); font-size: 18px;
    cursor: pointer; flex-shrink: 0; margin-right: 8px;
  }

  .admin-main { padding: 12px; }
  .admin-page { padding: 0; }
  .page-header { flex-wrap: wrap; gap: 8px; }
  .page-header h2 { font-size: 18px; }

  /* Customer layout */
  .customer-layout { padding: 8px; gap: 8px; height: auto; }
  .chat-panel { max-height: 45vh; }

  /* Tables — horizontal scroll */
  .table-wrap, .admin-page > div { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; }

  /* Modals → full screen */
  .modal { padding: 0; }
  .modal-content { width: 100% !important; max-width: none !important; max-height: 100vh; border-radius: 0; }
  .modal-content.large { width: 100% !important; }

  /* Stats */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px; }

  /* Top nav */
  .nav-customer-zone { gap: 8px; }
  .nav-user-badge span:first-child { max-width: 100px; }
  .nav-clock-wrap { display: none; }

  /* Merchant */
  .merchant-container { padding: 12px; }
  .merchant-hero { margin: 12px 12px 0; padding: 24px 16px; }
  .merchant-hero-main { font-size: 22px; }
  .merchant-section { padding: 16px; }
  .merchant-cat-select-group { grid-template-columns: 1fr; }
  .merchant-cat-overview { grid-template-columns: 1fr; }

  /* Forms → single column */
  .form-row { flex-direction: column; gap: 8px; }
  .merchant-reg-form .form-row { flex-direction: column; }
  .auth-form-box .form-row { flex-direction: column; }

  /* Chart cards */
  .chart-card { padding: 12px; }
  .chart-card canvas { max-height: 220px; }

  /* Drawer panel tabs — equal width, no wrap */
  .customer-tabs { flex-wrap: nowrap; gap: 0; }
  .customer-tabs .ctab { flex: 1; text-align: center; padding: 8px 4px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Top nav: hide Install text, compact actions */
  .nav-install-btn span { display: none; }
  .nav-install-btn { padding: 6px 8px; }
  .nav-actions { gap: 4px; }

  /* Quick tags: stack vertically for full-width tap targets */
  .quick-tags { flex-direction: column; gap: 6px; align-items: stretch; }
  .quick-tag { width: 100%; text-align: center; padding: 8px 12px; font-size: 12px; }

  /* Sub-tabs: horizontal scroll to prevent truncation */
  .ctab-subnav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .ctab-subnav::-webkit-scrollbar { display: none; }
  .ctab-sub { padding: 7px 10px; font-size: 11px; flex-shrink: 0; }

  /* Chat input: compact height */
  .chat-input { height: 40px; font-size: 13px; }
  .chat-btn-icon { height: 40px; font-size: 18px; }
  .chat-btn-send { height: 40px; padding: 0 16px; font-size: 13px; }
  .chat-input-area { padding: 8px 10px; }

  /* Work section: compact padding */
  .work-section { padding: 12px; }
  .work-section-title { font-size: 14px; margin: -12px -12px 10px; padding: 12px 12px 6px; }

  /* Welcome logo: slightly smaller */
  .welcome-logo-img { width: 60px; height: 60px; }
  .welcome-text { font-size: 12px; margin-bottom: 12px; }
}

@media (max-width: 480px) {
  .top-nav { padding: 0 6px; gap: 4px; }
  .logo-text { font-size: 13px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-customer-zone { gap: 4px; }
  .nav-user-badge { padding: 2px 6px; }
  .nav-user-badge span:first-child { max-width: 60px; font-size: 11px; }
  .nav-logout-btn { font-size: 11px; padding: 2px 6px; }
  .call-btn { width: 32px; height: 32px; font-size: 14px; }
  .hamburger-btn { width: 32px; height: 32px; font-size: 18px; }

  /* Hide Install button entirely on very small screens */
  .nav-install-btn { display: none; }
  .nav-lang-btn { padding: 4px 8px; font-size: 12px; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 10px; }
  .stat-card .stat-value { font-size: 18px; }
  .stat-card .stat-label { font-size: 10px; }

  .chart-card { padding: 10px; }
  .chart-card canvas { max-height: 180px; }

  .customer-layout { padding: 4px; gap: 4px; }
  .chat-panel { max-height: 38vh; }
  .chat-panel-header { padding: 8px 12px; }
  .chat-panel-title { font-size: 13px; }
  .chat-panel-status { font-size: 10px; }
  .chat-input { height: 36px; font-size: 12px; padding: 0 10px; }
  .chat-btn-icon { height: 36px; font-size: 16px; }
  .chat-btn-send { height: 36px; padding: 0 12px; font-size: 12px; }
  .chat-input-area { padding: 6px 8px; }
  .chat-area { padding: 10px; gap: 8px; }
  .welcome-logo-img { width: 48px; height: 48px; margin-bottom: 8px; }
  .welcome-text { font-size: 11px; margin-bottom: 10px; }
  .quick-tag { font-size: 11px; padding: 7px 10px; }

  .ctab-sub { padding: 6px 8px; font-size: 10px; }
  .customer-tabs .ctab { font-size: 10px; padding: 6px 2px; }
  .work-section { padding: 8px; }
  .work-section-title { font-size: 13px; margin: -8px -8px 8px; padding: 8px 8px 4px; }

  .client-auth-card { padding: 16px 12px; margin: 0; }
  .auth-logo-img { width: 56px !important; height: 56px !important; }

  .merchant-hero { padding: 20px 12px; margin: 8px 8px 0; }
  .merchant-hero-main { font-size: 18px; }
  .merchant-hero-sub-cn { font-size: 13px; }

  .page-header h2 { font-size: 16px; }
  .admin-main { padding: 8px; }

  .toast { right: 8px; left: 8px; bottom: 16px; text-align: center; }

  .modal-body { padding: 12px; }
  .modal-header { padding: 12px; }
  .modal-header h3 { font-size: 16px; }

  .nav-item { padding: 10px 16px; font-size: 14px; }
}

/* ============================================================
   Mobile Responsive: Merchant / Service Provider / Admin
   ============================================================ */
@media (max-width: 768px) {
  /* === Merchant Dashboard === */
  .merchant-container { padding: 8px; }
  .merchant-section { padding: 12px; margin-bottom: 12px; }
  .merchant-reg-form .form-row { flex-direction: column; }
  .merchant-reg-form .form-item { width: 100%; }
  .merchant-cat-select-group { grid-template-columns: 1fr 1fr; gap: 8px; }
  .merchant-selected-cat { flex-direction: column; gap: 8px; }

  /* === Service Provider View === */
  #marineServiceView .merchant-section { padding: 12px; }
  .msp-dashboard-grid { grid-template-columns: 1fr !important; }

  /* === Admin: New pages (Payments, Sub-Accounts) === */
  #page-payments .page-header,
  #page-subAccounts .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  #subAccountFilterBar { flex-direction: column; gap: 8px !important; }
  #subAccountFilterBar select,
  #subAccountFilterBar input { width: 100%; }
  #payLogFilterType, #payLogFilterStatus { width: auto; min-width: 0; }
  .data-table { min-width: 500px; font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .data-table th { font-size: 11px; }

  /* === CS Widget mobile === */
  .cs-widget { width: 100vw !important; max-width: 100vw !important; height: 100vh !important; max-height: 100vh !important; border-radius: 0 !important; border: none !important; }
  .cs-widget-root { bottom: 0; right: 0; left: 0; top: 0; --offset-edge: 0; }
  .cs-sidebar { width: 100vw; position: absolute; z-index: 10; }
  .cs-mobile-only { display: flex !important; }
  .cs-quick-replies { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  /* Merchant hero compact */
  .merchant-hero { padding: 16px 10px; margin: 4px 4px 0; }
  .merchant-hero-main { font-size: 16px; }
  .merchant-hero-sub-cn { font-size: 12px; }
  .merchant-hero-desc { font-size: 11px; }
  .merchant-cat-select-group { grid-template-columns: 1fr; }

  /* Admin tables: even more compact */
  .data-table { min-width: 400px; font-size: 11px; }
  .data-table th, .data-table td { padding: 4px 6px; }

  /* CS Widget quick replies single column on very small screens */
  .cs-quick-replies { grid-template-columns: 1fr; }
}

/* ============================================================
   H5 Mobile Fix (2026-08-26) — 360px min width support
   ============================================================ */
@media (max-width: 768px) {
  /* === Merchant Dashboard === */
  .merchant-dash-card { padding: 12px !important; }
  .merchant-dash-header { flex-direction: column; gap: 8px; align-items: flex-start !important; }
  .merchant-dash-header-right { width: 100%; }
  .merchant-global-search { width: 100%; }
  .merchant-global-search input { width: 100%; }
  .merchant-dash-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 0 !important; }
  .merchant-dash-tabs::-webkit-scrollbar { display: none; }
  .merchant-dash-tab { flex-shrink: 0; padding: 8px 12px !important; font-size: 12px !important; white-space: nowrap; }
  .merchant-dash-tab .tab-label { font-size: 11px; }
  .merchant-hero-main { font-size: clamp(16px, 4vw, 22px) !important; }
  .merchant-hero-sub-cn { font-size: clamp(12px, 3vw, 14px) !important; }
  .merchant-hero-desc { font-size: 11px !important; }

  /* Merchant stats grid → 2 columns */
  .merchant-stat-row, .merchant-stats { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .merchant-stat-card { padding: 10px !important; }

  /* Merchant quick actions → vertical */
  .merchant-quick-actions, .quick-action-row { flex-direction: column !important; gap: 8px !important; }
  .merchant-quick-actions button, .quick-action-row button { width: 100% !important; }

  /* Merchant breadcrumb → compact */
  .merchant-breadcrumb { flex-wrap: wrap; font-size: 11px; }

  /* === Service Provider (MSP) === */
  .msp-tab-row, .msp-tabs { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; scrollbar-width: none !important; }
  .msp-tab-row::-webkit-scrollbar, .msp-tabs::-webkit-scrollbar { display: none !important; }
  .msp-tab-btn { flex-shrink: 0 !important; padding: 8px 12px !important; font-size: 12px !important; white-space: nowrap !important; }

  /* MSP inquiry cards → labels wrap */
  .msp-inquiry-card, .msp-quote-card { padding: 12px !important; }
  .msp-inquiry-tags, .msp-card-labels { flex-wrap: wrap !important; gap: 4px !important; }
  .msp-inquiry-tags span, .msp-card-labels span { font-size: 10px !important; padding: 2px 6px !important; }

  /* MSP sub-account button → full width */
  .msp-sub-account-btn { width: 100% !important; }

  /* === Admin pages === */
  .admin-page > div { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #page-payments .page-header { flex-direction: column; align-items: flex-start; }
  /* Payment gateway config grid → single column */
  #page-payments > div:nth-child(2) > div:nth-child(2) { grid-template-columns: 1fr !important; }
  /* Commission config 3-column → single column */
  #page-payments > div:nth-child(3) > div:nth-child(3) { grid-template-columns: 1fr !important; }
  /* Split preview → wrap */
  #page-payments > div:nth-child(4) > div:nth-child(2) { flex-wrap: wrap !important; }

  /* === Global: buttons min touch target 44px === */
  button, .btn, .btn-primary, .btn-outline, .btn-link {
    min-height: 44px;
    min-width: 44px;
  }
  button[style*="padding:4px"], button[style*="padding: 4px"] {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  /* 360px minimum support */
  .merchant-dash-company { font-size: 14px !important; }
  .merchant-dash-meta { font-size: 10px !important; }
  .merchant-stat-card .stat-value { font-size: 16px !important; }
  .merchant-stat-card .stat-label { font-size: 9px !important; }

  /* MSP stat row → single column */
  .merchant-stat-row, .merchant-stats { grid-template-columns: 1fr 1fr !important; }

  /* Merchant hero → ultra compact */
  .merchant-hero { padding: 12px 8px !important; margin: 4px 4px 0 !important; }
  .merchant-hero-main { font-size: 15px !important; }

  /* Split preview → vertical */
  #page-payments > div:nth-child(4) > div:nth-child(2) { flex-direction: column !important; align-items: stretch !important; }
  #page-payments > div:nth-child(4) > div:nth-child(2) > div { width: 100% !important; text-align: center !important; }
  #page-payments > div:nth-child(4) > div:nth-child(2) > span { display: none !important; }
}
.merchant-container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.merchant-onboarding { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.merchant-hero { background: linear-gradient(135deg, #1967d2, #4285f4); color: var(--white); border-radius: var(--radius); margin: 24px 24px 0; padding: 48px 48px; text-align: center; }
.merchant-hero-inner { max-width: 720px; margin: 0 auto; }
.merchant-hero-main { font-size: 28px; font-weight: 700; margin-bottom: 6px; letter-spacing: 0.5px; }
.merchant-hero-sub-cn { font-size: 16px; font-weight: 500; opacity: 0.9; margin-bottom: 12px; }
.merchant-hero-desc { font-size: 12px; opacity: 0.65; line-height: 1.6; }
.merchant-section { padding: 24px 32px; border-bottom: 1px solid var(--gray-100); }
.merchant-section h3 { font-size: 16px; color: var(--primary); margin-bottom: 16px; }

/* Merchant category cascading dropdown */
.merchant-cat-select-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.merchant-cat-select-group .form-item { display: flex; flex-direction: column; }
.merchant-cat-select-group label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; }
.merchant-cat-select-group select { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; background: var(--white); cursor: pointer; transition: border-color 0.2s; }
.merchant-cat-select-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(25,103,210,0.1); }
.merchant-cat-select-group select:disabled { background: var(--gray-100); color: var(--gray-400); cursor: not-allowed; }
.merchant-selected-cat { margin-top: 8px; padding: 10px 16px; background: var(--primary-light); border-radius: var(--radius-sm); border-left: 3px solid var(--primary); font-size: 13px; color: var(--gray-700); }
.merchant-selected-cat strong { color: var(--primary); }

/* Legacy merchant category grid (kept for admin overview) */
.merchant-category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.merchant-cat-card { border: 2px solid var(--gray-200); border-radius: var(--radius-sm); padding: 16px; cursor: pointer; transition: all 0.2s; text-align: center; }
.merchant-cat-card:hover { border-color: var(--primary); background: var(--primary-light); }
.merchant-cat-card.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 2px rgba(25,103,210,0.2); }
.merchant-cat-card .cat-icon { font-size: 32px; margin-bottom: 8px; }
.merchant-cat-card .cat-name { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.merchant-cat-card .cat-desc { font-size: 11px; color: var(--gray-400); margin-top: 4px; line-height: 1.4; }

/* Merchant registration form */
.merchant-reg-form .form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.merchant-reg-form .form-item { flex: 1; }
.merchant-reg-form .form-item.full { flex: 1; }
.merchant-reg-form label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; }
.merchant-reg-form input, .merchant-reg-form textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; }
.merchant-reg-form input:focus, .merchant-reg-form textarea:focus { outline: none; border-color: var(--primary); }
.btn-merchant-submit { width: 100%; margin-top: 16px; padding: 12px; font-size: 15px; }

/* Merchant import area */
.merchant-import-hint { font-size: 13px; color: var(--gray-600); margin-bottom: 14px; line-height: 1.65; }
.merchant-import-hint code { background: #fff; padding: 2px 8px; border-radius: 4px; font-size: 12px; border: 1px solid var(--gray-200); color: var(--primary); }
.merchant-import-area textarea { width: 100%; padding: 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; font-family: 'Courier New', monospace; resize: vertical; }
.merchant-import-actions { display: flex; gap: 8px; margin-top: 12px; }
.import-preview { margin-top: 16px; }
.import-count { font-size: 13px; color: var(--success); font-weight: 600; margin-bottom: 8px; }
.import-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.import-table th { background: var(--gray-100); padding: 8px; text-align: left; font-weight: 600; color: var(--gray-600); }
.import-table td { padding: 8px; border-bottom: 1px solid var(--gray-100); }
.import-error { color: var(--danger); font-size: 13px; }

/* Batch Import CTA (new) */
.batch-import-cta { display: flex; flex-direction: column; gap: 14px; }
.btn-batch-import {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #1967d2 0%, #0d47a1 100%);
  color: #fff; border: none; padding: 18px 24px;
  font-size: 16px; font-weight: 600; border-radius: 12px;
  cursor: pointer; box-shadow: 0 4px 14px rgba(25,103,210, 0.25);
  transition: all 0.2s; width: 100%; text-align: left;
}
.btn-batch-import:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(25,103,210, 0.4); }
.btn-batch-import:active { transform: translateY(0); }
.btn-batch-import .bico { font-size: 32px; line-height: 1; }
.btn-batch-import .blbl { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.btn-batch-import .btitle { font-size: 17px; font-weight: 700; }
.btn-batch-import .bsub { font-size: 12px; opacity: 0.85; font-weight: 400; }
.btn-batch-import .barrow { font-size: 28px; opacity: 0.7; }

.batch-import-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-quick-mode {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #fff; border: 1.5px solid #bbdefb; color: #1967d2;
  padding: 12px 16px; font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all 0.15s;
}
.btn-quick-mode .qico { font-size: 18px; }
.btn-quick-mode:hover { background: #e8f0fe; border-color: #1967d2; transform: translateY(-1px); }
.btn-quick-mode.excel { border-color: #ffcc80; color: #e65100; background: #fff3e0; }
.btn-quick-mode.excel:hover { background: #ffe0b2; border-color: #e65100; }

@media (max-width: 640px) {
  .batch-import-quick { grid-template-columns: 1fr; }
  .btn-batch-import .bico { font-size: 24px; }
}

/* Merchant pending status */
.merchant-pending-card { text-align: center; padding: 32px; }
.pending-icon { font-size: 48px; margin-bottom: 12px; }
.merchant-pending-card h3 { color: var(--warning); margin-bottom: 8px; }
.merchant-pending-card p { color: var(--gray-500); font-size: 13px; line-height: 1.6; }
.pending-id { margin-top: 12px; font-weight: 600; color: var(--primary); }

.merchant-rejected-card { background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-md); padding: 24px; margin-bottom: 20px; }
.merchant-rejected-card .rejected-icon { font-size: 36px; text-align: center; margin-bottom: 8px; }
.merchant-rejected-card h3 { color: #dc2626; text-align: center; margin-bottom: 16px; }
.rejected-section { background: #fff; border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 12px; border-left: 3px solid #dc2626; }
.rejected-label { font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.rejected-text { font-size: 14px; color: var(--gray-700); line-height: 1.6; white-space: pre-wrap; }
.rejected-meta { font-size: 12px; color: var(--gray-500); margin: 8px 0 16px; text-align: center; }
.btn-resubmit { display: block; margin: 12px auto 0; min-width: 240px; }
.reject-target { background: #ffe0b2; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; color: #e65100; margin-bottom: 16px; }
.reject-hint { font-size: 12px; color: var(--gray-500); margin: 8px 0 16px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* Merchant entry button */
.merchant-btn { background: var(--success); }
.merchant-btn:hover { background: #0d5f2b; }

/* Merchant category overview */
.merchant-cat-overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.merchant-cat-stat { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--white); border-radius: var(--radius-sm); border: 1px solid var(--gray-200); cursor: pointer; transition: all 0.2s; }
.merchant-cat-stat:hover { border-color: var(--primary); background: var(--primary-light); }
.merchant-cat-stat .mcs-icon { font-size: 28px; }
.merchant-cat-stat .mcs-name { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.merchant-cat-stat .mcs-counts { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* Merchant detail grid */
.merchant-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin-top: 12px; font-size: 13px; }
.merchant-detail-grid .label { font-weight: 600; color: var(--gray-500); margin-right: 4px; }

/* Merchant match items in inquiry summary */
.inquiry-merchant-section { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--gray-300); }
.merchant-match-header { font-size: 11px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.merchant-match-item { display: flex; align-items: center; gap: 6px; font-size: 11px; padding: 4px 0; }
.mm-part { font-weight: 600; color: var(--gray-700); min-width: 90px; }
.mm-supplier { color: var(--gray-600); flex: 1; }
.mm-price { color: var(--success); font-weight: 600; }
.mm-stock { font-size: 10px; padding: 1px 6px; border-radius: 4px; }
.mm-stock.in { background: #e6f4ea; color: var(--success); }
.mm-stock.out { background: #FEE2E2; color: var(--danger); }
.mm-lead { color: var(--gray-400); }

/* Badge for rejected/suspended */
.badge-rejected { background: #FEE2E2; color: var(--danger); }

/* ============ New Module Styles (v9) ============ */

/* Badge color variants */
.badge-green { background: #e6f4ea; color: #137333; }
.badge-blue { background: #DBEAFE; color: #2563EB; }
.badge-orange { background: #FFEDD5; color: #C2410C; }
.badge-gray { background: #F3F4F6; color: #6B7280; }
.badge-purple { background: #F3E8FF; color: #7C3AED; }
.badge-red { background: #FEE2E2; color: #B91C1C; }

/* Button variants */
.btn-success { background: var(--success); color: white; border: none; padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; transition: opacity 0.2s; }
.btn-success:hover { opacity: 0.85; }
.btn-danger { background: var(--danger); color: white; border: none; padding: 4px 10px; border-radius: 4px; font-size: 12px; cursor: pointer; transition: opacity 0.2s; }
.btn-danger:hover { opacity: 0.85; }

/* Stats 2-column grid */
.stats-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Stats detail panel */
.stats-detail-panel { padding: 12px 0; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--gray-200); font-size: 13px; }
.stat-row:last-child { border-bottom: none; }
.stat-row span { color: var(--gray-600); }
.stat-row strong { font-size: 16px; }

/* Detail grid for modals */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; font-size: 13px; }
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-item label { font-weight: 600; color: var(--gray-500); font-size: 11px; text-transform: uppercase; }
.detail-item span { color: var(--gray-800); }

/* Form grid for add/edit modals */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .form-item { display: flex; flex-direction: column; gap: 4px; }
.form-grid .form-item.full { grid-column: 1 / -1; }
.form-grid .form-item label { font-size: 12px; font-weight: 600; color: var(--gray-600); }
.form-grid .form-item input,
.form-grid .form-item select,
.form-grid .form-item textarea {
  padding: 8px 10px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 13px;
}

/* Badge mini (for template fields, tags) */
.badge-mini { display: inline-block; padding: 3px 10px; margin: 2px 4px 2px 0; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }

/* Quote template preview */
.quote-template-preview { display: flex; flex-wrap: wrap; gap: 4px; padding: 12px; background: var(--gray-100); border-radius: 8px; }
.quote-template-preview .badge-mini { background: #1a1a2e; color: white; border-color: #1a1a2e; }

/* Stat icon color variants */
.stat-icon.blue { background: #DBEAFE; }
.stat-icon.purple { background: #F3E8FF; }
.stat-icon.green { background: #e6f4ea; }
.stat-icon.orange { background: #FFEDD5; }
.stat-icon.red { background: #FEE2E2; }
.stat-icon.gray { background: #F3F4F6; }

/* Form label/input styles for settings */
.form-label { font-size: 12px; font-weight: 600; color: var(--gray-600); display: block; margin-bottom: 4px; }
.form-input { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; box-sizing: border-box; }
.form-textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; resize: vertical; box-sizing: border-box; }

/* Notifications list */
.notifications-list { display: flex; flex-direction: column; gap: 12px; }
.notif-card {
  display: flex; gap: 14px; padding: 16px; background: var(--card-bg, #fff);
  border-radius: 8px; border: 1px solid var(--border, #e5e7eb); transition: box-shadow 0.2s;
}
.notif-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.notif-card.unread { background: #f0f9ff; border-color: #bae6fd; }
.notif-icon { font-size: 28px; flex-shrink: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--gray-100, #f3f4f6); }
.notif-content { flex: 1; min-width: 0; }
.notif-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; gap: 12px; }
.notif-title { font-weight: 600; font-size: 14px; color: var(--text, #1a1a2e); }
.notif-time { font-size: 12px; color: var(--gray-400, #9ca3af); white-space: nowrap; flex-shrink: 0; }
.notif-message { font-size: 13px; color: var(--gray-500, #6b7280); line-height: 1.5; margin: 0 0 8px 0; }
.notif-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.notif-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Role cards */
.role-list { display: flex; flex-direction: column; gap: 0; }

/* Filter input */
.filter-input { padding: 6px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 13px; min-width: 200px; }

/* ============ Product Blueprint View ============ */
.blueprint-btn { background: linear-gradient(135deg, var(--accent), var(--primary)) !important; }
.blueprint-btn:hover { opacity: 0.92; }
.blueprint-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px 64px; }

/* Hero */
.bp-hero { background: linear-gradient(135deg, #0d47a1 0%, #1967d2 45%, #4285f4 100%); border-radius: 0 0 24px 24px; padding: 56px 48px; color: #fff; margin-bottom: 40px; position: relative; overflow: hidden; }
.bp-hero::after { content: ''; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%; background: rgba(255,255,255,0.06); }
.bp-hero-inner { position: relative; z-index: 1; max-width: 880px; }
.bp-hero-badge { display: inline-block; padding: 5px 14px; background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.3); border-radius: 20px; font-size: 12px; font-weight: 600; letter-spacing: 1px; margin-bottom: 18px; }
.bp-hero h1 { font-size: 34px; font-weight: 800; line-height: 1.2; margin-bottom: 14px; letter-spacing: -0.5px; }
.bp-hero-sub { font-size: 15px; line-height: 1.7; color: rgba(255,255,255,0.88); margin-bottom: 28px; }
.bp-hero-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.bp-stat { background: rgba(255,255,255,0.12); border-radius: 12px; padding: 14px 20px; min-width: 96px; text-align: center; }
.bp-stat-num { display: block; font-size: 26px; font-weight: 800; line-height: 1.1; }
.bp-stat-label { display: block; font-size: 12px; color: rgba(255,255,255,0.78); margin-top: 2px; }
.bp-stat.done .bp-stat-num { color: #6EE7B7; }
.bp-stat.partial .bp-stat-num { color: #FCD34D; }
.bp-stat.plan .bp-stat-num { color: #FCA5A5; }
.bp-stat.pct { background: rgba(255,255,255,0.22); }
.bp-hero-progress { height: 8px; background: rgba(255,255,255,0.2); border-radius: 6px; overflow: hidden; max-width: 520px; }
.bp-hero-progress-bar { height: 100%; background: linear-gradient(90deg, #6EE7B7, #34D399); border-radius: 6px; transition: width 0.8s ease; }

/* Section */
.bp-section { margin-bottom: 48px; }
.bp-section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.bp-section-tag { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 28px; padding: 0 10px; background: var(--primary); color: #fff; border-radius: 8px; font-size: 13px; font-weight: 700; }
.bp-section-head h2 { font-size: 24px; font-weight: 800; color: var(--gray-900); }
.bp-section-intro { font-size: 14px; line-height: 1.8; color: var(--gray-600); background: var(--gray-50); border-left: 3px solid var(--accent); padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 16px 0 24px; }

/* Compare */
.bp-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.bp-compare-col { border-radius: 14px; padding: 24px; }
.bp-compare-col.pain { background: #FEF2F2; border: 1px solid #FECACA; }
.bp-compare-col.sol { background: #ECFDF5; border: 1px solid #A7F3D0; }
.bp-compare-col h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.bp-compare-col.pain h3 { color: #B91C1C; }
.bp-compare-col.sol h3 { color: #137333; }
.bp-compare-col ul { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.bp-compare-col li { font-size: 14px; line-height: 1.6; color: var(--gray-700); display: flex; gap: 10px; align-items: flex-start; }
.bp-x { color: #EF4444; font-weight: 700; flex-shrink: 0; }
.bp-check { color: var(--success); font-weight: 700; flex-shrink: 0; }

/* Sub title */
.bp-sub-title { font-size: 18px; font-weight: 700; color: var(--gray-800); margin: 32px 0 16px; padding-left: 12px; border-left: 4px solid var(--primary); }

/* Table */
.bp-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--gray-200); box-shadow: var(--shadow); }
.bp-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
.bp-table thead { background: var(--primary); color: #fff; }
.bp-table th { padding: 12px 14px; text-align: left; font-weight: 600; white-space: nowrap; }
.bp-table td { padding: 11px 14px; border-top: 1px solid var(--gray-100); vertical-align: top; }
.bp-table tbody tr:hover { background: var(--primary-light); }
.bp-table .bp-mod { font-weight: 600; color: var(--primary); white-space: nowrap; }
.bp-table .bp-sub { white-space: nowrap; color: var(--gray-700); }
.bp-table .bp-desc { color: var(--gray-600); min-width: 240px; }

/* Status */
.bp-status { display: inline-block; padding: 3px 10px; border-radius: var(--radius-xs); font-size: 12px; font-weight: 600; white-space: nowrap; }
.bp-status.done { background: #e6f4ea; color: #137333; }
.bp-status.partial { background: #fff3e0; color: #e65100; }
.bp-status.plan { background: #F3F4F6; color: var(--gray-500); }

/* Admin module cards */
.bp-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.bp-card { display: flex; align-items: flex-start; gap: 14px; background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: 16px; transition: all 0.2s; box-shadow: var(--shadow); }
.bp-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.bp-card.partial { border-left: 3px solid var(--warning); }
.bp-card.plan { border-left: 3px solid var(--gray-300); background: var(--gray-50); }
.bp-card-num { font-size: 13px; font-weight: 800; color: var(--primary); background: var(--primary-light); border-radius: 8px; padding: 6px 8px; min-width: 32px; text-align: center; }
.bp-card-body { flex: 1; }
.bp-card-title { font-size: 14px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.bp-card-desc { font-size: 12.5px; color: var(--gray-500); line-height: 1.5; }
.bp-card-status { flex-shrink: 0; }

/* Engine grid */
.bp-engine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.bp-engine { background: linear-gradient(160deg, #fff, var(--primary-light)); border: 1px solid var(--gray-200); border-radius: 14px; padding: 20px; text-align: center; transition: all 0.2s; }
.bp-engine:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.bp-engine-icon { font-size: 32px; margin-bottom: 10px; }
.bp-engine-name { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.bp-engine-desc { font-size: 12.5px; color: var(--gray-600); line-height: 1.5; margin-bottom: 12px; min-height: 54px; }

/* Ops grid */
.bp-ops-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.bp-ops { background: #fff; border: 1px solid var(--gray-200); border-radius: 14px; padding: 20px; transition: all 0.2s; }
.bp-ops:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.bp-ops-icon { font-size: 28px; margin-bottom: 10px; }
.bp-ops-name { font-size: 15px; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.bp-ops-desc { font-size: 12.5px; color: var(--gray-600); line-height: 1.5; margin-bottom: 12px; }

/* Support grid */
.bp-support-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.bp-support { background: linear-gradient(160deg, #fff, var(--primary-light)); border: 1px solid var(--gray-200); border-radius: 14px; padding: 22px; transition: all 0.2s; }
.bp-support:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.bp-support-icon { font-size: 30px; margin-bottom: 12px; }
.bp-support-name { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.bp-support-desc { font-size: 13px; color: var(--gray-600); line-height: 1.6; margin-bottom: 12px; }

/* Footer note */
.bp-footer-note { text-align: center; padding: 32px 0 0; margin-top: 16px; border-top: 1px solid var(--gray-200); }
.bp-footer-note p { font-size: 13px; color: var(--gray-500); line-height: 1.7; }

/* Responsive */
@media (max-width: 768px) {
  .bp-hero { padding: 36px 24px; }
  .bp-hero h1 { font-size: 24px; }
  .bp-compare { grid-template-columns: 1fr; }
  .bp-card-grid, .bp-engine-grid, .bp-ops-grid, .bp-support-grid { grid-template-columns: 1fr; }
  .bp-section-head h2 { font-size: 20px; }
}

/* ===== Batch Import Modal ===== */
.batch-modal-content { max-width: 1100px; width: 96%; }
.batch-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 20px; }
.batch-tab { padding: 10px 24px; border: none; background: none; font-size: 14px; font-weight: 600; cursor: pointer; border-bottom: 3px solid transparent; color: #999; transition: all .15s; }
.batch-tab.active { border-bottom-color: #1967d2; color: #1967d2; }

.batch-info { border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; font-size: 13px; line-height: 1.7; }
.batch-info.blue { background: #e8f0fe; border: 1px solid #bbdefb; color: #0d47a1; }
.batch-info.yellow { background: #fff3e0; border: 1px solid #ffcc80; color: #e65100; }
.batch-info code { background: #fff; padding: 2px 8px; border-radius: 4px; font-size: 12px; }

.batch-paste-area { width: 100%; font-family: 'Consolas','Courier New',monospace; font-size: 13px; padding: 12px; border: 1px solid #d0d0d0; border-radius: 8px; resize: vertical; }

.batch-drop-zone { border: 2px dashed #c0d0e0; border-radius: 12px; padding: 32px; text-align: center; background: #fafcff; transition: all .2s ease; }
.batch-drop-zone.drag-over { border-color: #1967d2; background: #e8f0fe; transform: scale(1.01); }

.batch-mapping-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.batch-mapping-item { display: flex; flex-direction: column; gap: 4px; }
.batch-mapping-item label { font-size: 11px; color: #666; }
.batch-mapping-item select { padding: 4px 8px; font-size: 12px; border: 1px solid #d0d0d0; border-radius: 4px; }

.batch-preview-wrap { max-height: 360px; overflow: auto; border: 1px solid #e0e0e0; border-radius: 8px; }
.batch-preview-wrap thead { position: sticky; top: 0; z-index: 10; }
.batch-preview-wrap th { min-width: 90px; padding: 6px 8px; text-align: left; font-size: 12px; white-space: nowrap; }
.batch-cell-input { width: 100%; border: 1px solid transparent; padding: 4px 6px; font-size: 12px; }
.batch-cell-input:focus { border-color: #1967d2; outline: none; }
.batch-cell-input.part-no { font-weight: 600; }
.batch-del-btn { border: none; background: none; color: #e76f51; cursor: pointer; font-size: 14px; }

.batch-footer { margin-top: 20px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #e0e0e0; padding-top: 16px; }

/* ============ Merchant Dashboard ============ */
.merchant-login-form { max-width: 520px; }
.merchant-login-form .form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.merchant-login-form .form-item { flex: 1; }
.merchant-login-form label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; }
.merchant-login-form input { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; box-sizing: border-box; }
.merchant-login-form input:focus { outline: none; border-color: var(--primary); }
.auth-switch-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.merchant-setpwd-link { margin-top: 10px; font-size: 13px; color: var(--primary); text-decoration: underline; }
.merchant-setpwd-desc { font-size: 13px; color: var(--gray-500); margin-bottom: 16px; }

/* Merchant Dashboard Info Card (white container wrapping header) */
.merchant-dash-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.merchant-dash-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 18px 24px; }
.merchant-dash-info h3.merchant-dash-company { font-size: 16px; font-weight: 700; color: var(--gray-800); margin-bottom: 4px; }
.merchant-dash-meta { font-size: 12px; color: var(--gray-400); margin: 0 0 6px; }
.merchant-status-badge { display: inline-block; padding: 1px 8px; border-radius: var(--radius-xs); font-size: 10px; font-weight: 600; color: #fff; }
.merchant-status-badge.green { background: var(--success); }
.merchant-status-badge.orange { background: var(--warning); }
.merchant-status-badge.red { background: #dc2626; }

/* Merchant Dashboard Header Right (global search + logout) */
.merchant-dash-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.merchant-global-search { position: relative; display: flex; align-items: center; }
.merchant-global-search input {
  width: 220px; padding: 8px 36px 8px 14px; border: 1px solid var(--gray-300);
  border-radius: 20px; font-size: 13px; box-sizing: border-box; transition: all 0.2s;
}
.merchant-global-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(25,103,210,0.1); width: 260px; }
.merchant-global-search .mgs-icon {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; opacity: 0.5; cursor: pointer; pointer-events: auto; transition: opacity 0.2s;
}
.merchant-global-search .mgs-icon:hover { opacity: 1; }
.merchant-logout-btn { font-size: 13px; font-weight: 500; white-space: nowrap; }

/* Merchant Breadcrumb Navigation */
.merchant-breadcrumb {
  display: flex; align-items: center; gap: 6px; margin-bottom: 16px;
  font-size: 13px; color: var(--gray-500);
}
.merchant-breadcrumb .bc-item { padding: 2px 0; }
.merchant-breadcrumb .bc-link { color: var(--gray-500); cursor: pointer; transition: color 0.2s; }
.merchant-breadcrumb .bc-link:hover { color: var(--primary); }
.merchant-breadcrumb .bc-current { color: var(--primary); font-weight: 600; }
.merchant-breadcrumb .bc-sep { color: var(--gray-300); margin: 0 2px; }

.merchant-dash-products { margin-top: 16px; }
.merchant-dash-products-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.merchant-dash-products-header h4 { font-size: 15px; color: var(--primary); }
.merchant-empty { text-align: center; color: var(--gray-400); padding: 24px; font-size: 13px; }
.merchant-products-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.merchant-products-table th { text-align: left; padding: 8px 10px; background: var(--gray-50); border-bottom: 2px solid var(--gray-200); font-size: 12px; color: var(--gray-600); }
.merchant-products-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); }
.merchant-products-table tr:hover td { background: var(--gray-50); }
.btn-link.danger { color: #dc2626; }

.source-badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-xs); font-size: 11px; font-weight: 600; white-space: nowrap; }
.source-badge.merchant { background: #ffe0b2; color: #e65100; border: 1px solid #ffcc80; }
.source-badge.system { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ===== Merchant Dashboard Tabs ===== */
.merchant-dash-tabs { display: flex; gap: 6px; margin-bottom: 20px; padding: 8px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); flex-wrap: wrap; }
.merchant-dash-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 18px; border: none; background: var(--white);
  font-size: 14px; font-weight: 500; color: var(--gray-600); cursor: pointer;
  border-radius: var(--radius-sm); transition: all 0.2s;
}
.merchant-dash-tab:hover { background: var(--primary-light); color: var(--primary); }
.merchant-dash-tab.active { background: var(--primary); color: var(--white); font-weight: 600; box-shadow: 0 2px 8px rgba(25,103,210,0.25); }
.merchant-dash-tab .tab-icon { font-size: 16px; }
.merchant-tab-content { min-height: 300px; }

/* ===== Overview Tab ===== */
.merchant-overview-loading { text-align: center; padding: 40px; color: var(--gray-400); }
.merchant-stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
.merchant-stat-card {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 22px 16px; text-align: center; transition: all 0.2s; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.merchant-stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-2px); }
.merchant-stat-card[onclick]:hover, .merchant-stat-card.clickable { cursor: pointer; }
.merchant-stat-card.clickable:hover { border-color: var(--warning); box-shadow: 0 4px 16px rgba(230,81,0,0.12); }
.merchant-stat-card.clickable.blue:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(25,103,210,0.12); }
.merchant-stat-card.clickable.blue .stat-click-hint { color: var(--primary); }
.merchant-stat-card.sales.clickable:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(25,103,210,0.12); }
.merchant-stat-card.sales .stat-click-hint { color: var(--primary); }
.merchant-stat-card.warn { border-color: #ffcc80; background: var(--warning-bg); }
.merchant-stat-card.warn .stat-value { color: var(--warning); }
.merchant-stat-card.warn .stat-icon { color: var(--warning); }
.merchant-stat-card .stat-icon { font-size: 32px; margin-bottom: 10px; color: var(--primary); }
.merchant-stat-card .stat-value { font-size: 30px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.merchant-stat-card .stat-label { font-size: 12px; color: var(--gray-500); margin-top: 6px; }

/* Trend mini-icon in stat cards */
.merchant-stat-card .stat-trend {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--gray-100);
  font-size: 11px; font-weight: 500;
}
.merchant-stat-card .stat-trend svg { flex-shrink: 0; }
.merchant-stat-card .stat-trend.up { color: #137333; }
.merchant-stat-card .stat-trend.down { color: #dc2626; }
.merchant-stat-card .stat-trend.stable { color: var(--gray-400); }
.merchant-stat-card .stat-click-hint {
  margin-top: 6px; font-size: 11px; color: #d97706; font-weight: 600;
}

/* ===== Merchant Sales Detail Modal ===== */
.ms-summary { display: flex; gap: 16px; margin-bottom: 20px; }
.ms-summary-item { flex: 1; background: #f8f9fa; border-radius: var(--radius-sm); padding: 14px 16px; text-align: center; }
.ms-sum-label { display: block; font-size: 12px; color: var(--gray-500); margin-bottom: 6px; }
.ms-sum-value { display: block; font-size: 20px; font-weight: 700; color: var(--primary); }
.ms-empty { text-align: center; padding: 40px; color: var(--gray-400); }
.ms-txn-list { max-height: 420px; overflow-y: auto; }
.ms-txn-card { border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 12px; }
.ms-txn-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ms-txn-no { font-size: 15px; font-weight: 700; color: var(--primary); }
.ms-txn-status { padding: 2px 10px; border-radius: var(--radius-xs); font-size: 12px; font-weight: 600; }
.ms-txn-meta { font-size: 13px; color: var(--gray-500); margin-bottom: 10px; }
.ms-txn-sep { margin: 0 6px; color: var(--gray-300); }
.ms-txn-date { color: var(--gray-400); }
.ms-txn-items { border-top: 1px solid var(--gray-100); padding-top: 8px; }
.ms-item-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.ms-item-partno { font-weight: 600; color: var(--gray-700); min-width: 100px; }
.ms-item-name { flex: 1; color: var(--gray-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-item-qty { color: var(--gray-400); white-space: nowrap; }
.ms-item-total { font-weight: 600; color: var(--gray-700); min-width: 80px; text-align: right; }
.ms-txn-footer { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--gray-100); text-align: right; }
.ms-txn-amount { font-size: 14px; color: var(--gray-600); }
.ms-txn-amount strong { color: #137333; font-size: 16px; }

/* Merchant product filter tag */
.merchant-filter-tag {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff3e0; border: 1px solid #ffcc80; border-radius: 16px;
  padding: 4px 14px; font-size: 12px; color: #e65100; font-weight: 600; margin-bottom: 12px;
}
.merchant-filter-tag .mft-clear { cursor: pointer; opacity: 0.7; transition: opacity 0.2s; }
.merchant-filter-tag .mft-clear:hover { opacity: 1; }
.merchant-filter-tag .btn-export-sm {
  margin-left: 8px; padding: 2px 10px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--primary); background: #fff; color: var(--primary);
  border-radius: var(--radius-xs); cursor: pointer; transition: all 0.2s;
}
.merchant-filter-tag .btn-export-sm:hover { background: var(--primary); color: #fff; }

/* Section header with export button */
.merchant-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-200); }
.merchant-section-header h4 { font-size: 15px; color: var(--primary); margin: 0; }
.btn-export-excel {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  background: var(--success-bg); color: var(--success);
  border: 1px solid var(--success); border-radius: var(--radius-xs);
  cursor: pointer; transition: all 0.2s;
}
.btn-export-excel:hover { background: var(--success); color: #fff; }
.btn-restock-upload {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  background: #fef7e0; color: #b06000;
  border: 1px solid #f9ab00; border-radius: var(--radius-xs);
  cursor: pointer; transition: all 0.2s;
}
.btn-restock-upload:hover { background: #f9ab00; color: #fff; }
.btn-restock-upload.btn-export-sm { padding: 4px 10px; font-size: 12px; }

.merchant-overview-section { margin-bottom: 24px; }
.merchant-overview-section h4 { font-size: 15px; font-weight: 700; color: var(--gray-800); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-200); }
.merchant-quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.merchant-qa-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-weight: 600; transition: all 0.2s;
  text-align: center;
}
.merchant-qa-btn.primary { background: var(--primary); color: #fff; border: none; }
.merchant-qa-btn.primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(25,103,210,0.2); }
.merchant-qa-btn.secondary { background: var(--white); color: var(--primary); border: 1.5px solid var(--primary); }
.merchant-qa-btn.secondary:hover { background: var(--primary-light); transform: translateY(-1px); }
.merchant-qa-btn .qa-icon { font-size: 18px; }

.merchant-low-stock-list { display: flex; flex-direction: column; gap: 8px; }
.merchant-low-stock-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: #fff3e0; border: 1px solid #ffcc80; border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s; font-size: 13px;
}
.merchant-low-stock-item:hover { background: #ffe0b2; }
.merchant-low-stock-item .lsi-partno { font-weight: 600; color: var(--primary); min-width: 120px; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.merchant-low-stock-item .lsi-partno:hover { color: var(--primary-dark); }
.merchant-low-stock-item .lsi-name { flex: 1; color: var(--text); }
.merchant-low-stock-item .lsi-stock { color: #dc2626; font-weight: 600; }
.merchant-low-stock-item .lsi-restock {
  padding: 4px 12px; font-size: 12px; font-weight: 600;
  background: var(--success); color: #fff; border: none; border-radius: var(--radius-xs);
  cursor: pointer; transition: opacity 0.2s; white-space: nowrap;
}
.merchant-low-stock-item .lsi-restock:hover { opacity: 0.85; }

/* ===== Products Tab ===== */
.merchant-products-toolbar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.merchant-search-box { position: relative; flex: 1; min-width: 200px; }
.merchant-search-box input { width: 100%; padding: 8px 36px 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; box-sizing: border-box; }
.merchant-search-box input:focus { outline: none; border-color: var(--primary); }
.merchant-search-box .search-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: 0.5; pointer-events: none; }
.btn-batch-import.btn-sm { padding: 6px 12px; }
.btn-batch-import.btn-sm .bico { font-size: 16px; }
.btn-batch-import.btn-sm .btitle { font-size: 13px; }
.btn-batch-edit.btn-sm { padding: 6px 12px; background: #5f6368; color: #fff; border: none; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; }
.btn-batch-edit.btn-sm:hover:not(:disabled) { background: #3c4043; transform: translateY(-1px); }
.btn-batch-edit.btn-sm .bico { font-size: 16px; }
.btn-batch-edit.btn-sm .btitle { font-size: 13px; }
.batch-field-row { margin-bottom: 12px; }
.batch-field-row label { font-size: 13px; font-weight: 500; cursor: pointer; }
.batch-field-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #1967d2; }
.batch-field-input { margin-top: 6px; }
.batch-field-input input, .batch-field-input select { width: 100%; padding: 8px 12px; border: 1px solid #dadce0; border-radius: 6px; font-size: 13px; }
.batch-field-input input:focus, .batch-field-input select:focus { border-color: #1967d2; outline: none; }
.mp-row-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: #1967d2; }
#mpSelectAll { width: 16px; height: 16px; cursor: pointer; accent-color: #1967d2; }
.merchant-products-toolbar { gap: 8px; }
.merchant-product-count { font-size: 12px; color: var(--gray-500); margin-bottom: 8px; }
.merchant-products-table .mp-partno { font-weight: 600; color: var(--primary); }
.merchant-products-table .mp-actions { white-space: nowrap; display: flex; gap: 6px; }
.merchant-products-table .stock-warn { font-size: 11px; }

/* ===== Add Product Tab ===== */
.merchant-add-form { max-width: 700px; }
.merchant-add-form h4 { font-size: 18px; color: var(--primary); margin-bottom: 8px; }
.merchant-form-hint { font-size: 13px; color: var(--gray-500); margin-bottom: 20px; }
.merchant-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.merchant-form-grid .form-item label { font-size: 13px; font-weight: 600; color: var(--gray-600); display: block; margin-bottom: 4px; }
.merchant-form-grid .form-item input { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; box-sizing: border-box; }
.merchant-form-grid .form-item input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(25,103,210,0.08); }

/* ===== Import Tab ===== */
.merchant-import-panel { max-width: 700px; }
.merchant-import-panel h4 { font-size: 18px; color: var(--primary); margin-bottom: 8px; }
.merchant-import-panel .batch-import-cta { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.merchant-import-format { background: var(--gray-50); border-radius: 8px; padding: 16px; margin-top: 16px; }
.merchant-import-format h5 { font-size: 13px; color: var(--gray-600); margin-bottom: 8px; }
.merchant-format-example {
  font-family: 'Consolas', monospace; font-size: 13px; color: var(--primary);
  background: #eef2f6; padding: 8px 12px; border-radius: 4px; word-break: break-all;
}
.merchant-format-note { font-size: 12px; color: var(--gray-500); margin-top: 8px; }

/* ===== Merchant Info Tab ===== */
.merchant-info-panel { max-width: 700px; margin-bottom: 24px; }
.merchant-info-panel:last-child { margin-bottom: 0; }
.merchant-info-panel h4 { font-size: 18px; color: var(--primary); margin-bottom: 16px; }
.merchant-info-status-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.merchant-info-label { font-size: 14px; color: var(--gray-600); }
.merchant-info-table { width: 100%; border-collapse: collapse; }
.merchant-info-table tr { border-bottom: 1px solid var(--gray-100); }
.merchant-info-table td { padding: 10px 14px; font-size: 14px; }
.merchant-info-table .mi-field { width: 140px; color: var(--gray-500); font-weight: 600; white-space: nowrap; }
.merchant-info-table .mi-val { color: var(--text); }
.merchant-info-rejected { margin-top: 20px; padding: 16px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; }
.merchant-info-rejected h5 { font-size: 13px; color: #dc2626; margin-bottom: 6px; margin-top: 12px; }
.merchant-info-rejected h5:first-child { margin-top: 0; }
.merchant-info-rejected p { font-size: 14px; color: var(--text); margin-bottom: 8px; }
.merchant-info-rejected .btn-resubmit { margin-top: 12px; }

/* Low Stock Threshold Setting */
.merchant-threshold-setting { padding: 0; }
.threshold-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.threshold-label { font-size: 14px; font-weight: 600; color: var(--text); }
.threshold-desc { font-size: 12px; color: var(--gray-400); }
.threshold-input-row { display: flex; align-items: center; gap: 10px; }
.threshold-input {
  width: 100px; height: 40px; padding: 0 12px;
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 600; color: var(--primary);
  text-align: center; outline: none; transition: border-color 0.2s;
}
.threshold-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(25,103,210,0.1); }
.threshold-unit { font-size: 14px; color: var(--gray-500); }
.btn-save-threshold { padding: 8px 24px; font-size: 14px; margin-left: auto; }

/* ===== Product Detail Modal ===== */
.merchant-product-detail-modal { max-width: 560px; }
.mpd-partno-banner {
  background: var(--primary); color: #fff; border-radius: 8px;
  padding: 14px 18px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px;
}
.mpd-partno-banner .mpd-label { font-size: 12px; opacity: 0.7; }
.mpd-partno-banner .mpd-value { font-size: 18px; font-weight: 700; }
.mpd-table { width: 100%; border-collapse: collapse; }
.mpd-table tr { border-bottom: 1px solid var(--gray-100); }
.mpd-table td { padding: 10px 14px; font-size: 14px; }
.mpd-table .mpd-field { width: 130px; color: var(--gray-500); font-weight: 600; }
.mpd-table .mpd-val { color: var(--text); }



/* Model Filter Dropdown */
.merchant-model-filter { padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 13px; cursor: pointer; background: var(--white); color: var(--gray-700); outline: none; transition: border-color 0.2s; }
.merchant-model-filter:focus { border-color: var(--primary); }

/* Restock Modal */
.restock-modal-body { padding: 20px 24px; }
.restock-product-info { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--gray-50); border-radius: var(--radius-sm); margin-bottom: 16px; }
.restock-product-info .rp-partno { font-weight: 700; color: var(--primary); font-size: 16px; }
.restock-product-info .rp-name { font-size: 13px; color: var(--gray-600); }
.restock-product-info .rp-current { font-size: 12px; color: #dc2626; font-weight: 600; margin-left: auto; }
.restock-input-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.restock-input-row label { font-size: 14px; font-weight: 600; color: var(--gray-700); white-space: nowrap; }
.restock-input-row input { width: 120px; height: 40px; padding: 0 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 18px; font-weight: 700; color: var(--primary); text-align: center; outline: none; }
.restock-input-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(25,103,210,0.1); }
.restock-input-row .restock-unit { font-size: 14px; color: var(--gray-500); }
.restock-hint { font-size: 12px; color: var(--gray-400); margin-top: 8px; }

/* Products Part No. clickable */
.merchant-products-table .mp-partno { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }

/* Inquiry Excel auto-parse result */
.inquiry-parse-result { background:#fff; border:1px solid #e2e8f0; border-radius:8px; padding:12px; margin:4px 0; max-width:100%; overflow-x:auto; }
.inquiry-parse-result .ipr-header { padding-bottom:8px; border-bottom:1px solid #e2e8f0; margin-bottom:8px; }
.inquiry-parse-result .ipr-table { width:100%; border-collapse:collapse; font-size:12px; }
.inquiry-parse-result .ipr-table th { background:#f1f5f9; color:#475569; padding:6px 8px; text-align:left; font-weight:600; border-bottom:1px solid #e2e8f0; white-space:nowrap; }
.inquiry-parse-result .ipr-table td { padding:6px 8px; border-bottom:1px solid #f1f5f9; vertical-align:top; }
.inquiry-parse-result .ipr-table tr.ipr-miss { background:#fef2f2; }
.inquiry-parse-result .ipr-table tr.ipr-warn { background:#fff3e0; }
.inquiry-parse-result .ipr-table tr.ipr-ok { background:#f0fdf4; }
.inquiry-parse-result .ipr-total { margin-top:8px; padding:8px 12px; background:#e8f5e9; color:#2a9d8f; border-radius:6px; font-size:14px; text-align:right; }
.inquiry-parse-result .ipr-actions { margin-top:8px; display:flex; gap:8px; flex-wrap:wrap; }
.inquiry-parse-result .ipr-actions button { padding:6px 14px; border-radius:6px; border:1px solid #cbd5e1; background:#fff; cursor:pointer; font-size:12px; }
.inquiry-parse-result .ipr-actions button:hover { background:#f1f5f9; }
.inquiry-parse-result .ipr-actions .btn-primary { background:#2a9d8f; color:#fff; border-color:#2a9d8f; }
.inquiry-parse-result .ipr-actions .btn-primary:hover { background:#21867a; }

/* ===== Purchase Order Management ===== */
.po-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; margin-bottom: 16px; transition: all 0.2s; border: 1px solid var(--border-color); }
.po-card:hover { border-color: #c4d7f5; box-shadow: 0 2px 12px rgba(25,103,210,0.08); }
.po-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.po-card-title { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.po-card-customer { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.po-card-meta { display: flex; gap: 16px; font-size: 12px; color: var(--gray-400); flex-wrap: wrap; }
.po-card-meta span { display: flex; align-items: center; gap: 4px; }
.po-card-items { margin: 12px 0; }
.po-card-items table { width: 100%; border-collapse: collapse; }
.po-card-items th { text-align: left; font-size: 12px; color: var(--gray-400); padding: 6px 8px; border-bottom: 1px solid var(--border-color); font-weight: 500; }
.po-card-items td { padding: 6px 8px; font-size: 13px; border-bottom: 1px solid var(--gray-100); }
.po-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; }
.po-card-total { font-size: 15px; font-weight: 700; color: var(--primary); }
.po-card-actions { display: flex; gap: 8px; }
.po-status-badge { display: inline-block; padding: 2px 10px; border-radius: var(--radius-xs); font-size: 11px; font-weight: 600; }
.po-status-pending { background: var(--warning-bg); color: var(--warning); }
.po-status-confirmed { background: var(--primary-light); color: var(--primary); }
.po-status-stocking { background: #e8f0fe; color: var(--primary-dark); }
.po-status-ready { background: var(--success-bg); color: var(--success); }
.po-status-shipped { background: var(--primary-light); color: var(--primary); }
.po-status-in_transit { background: #e8f0fe; color: var(--primary-dark); }
.po-status-arrived { background: var(--success-bg); color: var(--success); }
.po-status-completed { background: var(--success-bg); color: var(--success); }
.po-status-rejected { background: #fee2e2; color: #c5221f; }
.po-status-cancelled { background: var(--gray-100); color: var(--gray-500); }
/* SPO-ALIGN-001: SPO 服务订单状态徽章配色（pending/confirmed/completed 已在上方定义，此处仅补 SPO 独有的 2 个） */
.po-status-in_progress { background: #fce4ec; color: #c5221f; }
.po-status-accepted { background: #e6f4ea; color: #137333; }

/* ===== Order Lifecycle Timeline ===== */
.order-timeline { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; position: relative; margin: 16px 0; }
.order-timeline::before { content: ''; position: absolute; top: 32px; left: 5%; right: 5%; height: 2px; background: var(--gray-200); z-index: 0; }
.timeline-node { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; flex: 1; }
.timeline-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--white); border: 2px solid var(--gray-300); display: flex; align-items: center; justify-content: center; font-size: 12px; transition: all 0.2s; }
.timeline-dot.active { background: var(--primary); border-color: var(--primary); color: var(--white); box-shadow: 0 0 0 4px rgba(25,103,210,0.12); }
.timeline-dot.done { background: var(--success); border-color: var(--success); color: var(--white); }
.timeline-dot.rejected { background: #c5221f; border-color: #c5221f; color: var(--white); }
.timeline-label { font-size: 11px; color: var(--gray-500); text-align: center; white-space: nowrap; }
.timeline-label.active { color: var(--primary); font-weight: 600; }
.timeline-label.done { color: var(--success); font-weight: 600; }
.timeline-date { font-size: 10px; color: var(--gray-400); }

/* ===== Email Log Center ===== */
.email-log-toolbar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; }
.email-log-search { flex: 1; padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 13px; }
.email-log-search:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(25,103,210,0.1); }
.email-log-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.email-log-table th { text-align: left; padding: 10px 12px; background: var(--gray-50); font-size: 12px; color: var(--gray-500); font-weight: 500; border-bottom: 1px solid var(--border-color); }
.email-log-table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--gray-100); }
.email-log-table tr:hover { background: var(--gray-50); }
.email-log-direction { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; }
.email-log-direction.inbound { color: var(--primary); }
.email-log-direction.outbound { color: var(--success); }
.email-log-subject { font-weight: 500; color: var(--gray-800); cursor: pointer; }
.email-log-subject:hover { color: var(--primary); }
.email-log-preview { font-size: 12px; color: var(--gray-400); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Logistics Tracking ===== */
.logistics-tracking-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; margin-bottom: 16px; }
.logistics-status-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.logistics-status-banner.preparing { background: var(--warning-bg); }
.logistics-status-banner.in_transit { background: var(--primary-light); }
.logistics-status-banner.delivered { background: var(--success-bg); }
.logistics-status-banner .lsb-icon { font-size: 24px; }
.logistics-status-banner .lsb-text { flex: 1; }
.logistics-status-banner .lsb-status { font-size: 14px; font-weight: 600; }
.logistics-status-banner .lsb-sub { font-size: 12px; color: var(--gray-500); }
.logistics-info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.logistics-info-item { padding: 10px 12px; background: var(--gray-50); border-radius: var(--radius-sm); }
.logistics-info-label { font-size: 11px; color: var(--gray-400); margin-bottom: 4px; }
.logistics-info-value { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.logistics-timeline { display: flex; flex-direction: column; gap: 0; margin: 16px 0; }
.logistics-timeline-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.logistics-timeline-item::before { content: ''; position: absolute; left: 7px; top: 20px; bottom: 0; width: 2px; background: var(--gray-200); }
.logistics-timeline-item:last-child::before { display: none; }
.logistics-timeline-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--gray-300); flex-shrink: 0; margin-top: 2px; }
.logistics-timeline-dot.active { background: var(--primary); border-color: var(--primary); }
.logistics-timeline-dot.done { background: var(--success); border-color: var(--success); }
.logistics-timeline-content { flex: 1; }
.logistics-timeline-status { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.logistics-timeline-note { font-size: 12px; color: var(--gray-500); }
.logistics-timeline-time { font-size: 11px; color: var(--gray-400); }

/* ===== Trade Documents ===== */
.doc-card { background: var(--white); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 12px; display: flex; align-items: center; gap: 16px; }
.doc-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; background: var(--primary-light); color: var(--primary); }
.doc-info { flex: 1; }
.doc-no { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.doc-type { font-size: 12px; color: var(--gray-400); }
.doc-actions { display: flex; gap: 8px; }
.doc-actions .btn { padding: 6px 12px; border-radius: var(--radius-xs); font-size: 12px; cursor: pointer; }

/* ===== AI Comparison Panel ===== */
.ai-compare-panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px; margin: 16px 0; }
.ai-compare-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.ai-compare-header .ai-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--radius-xs); background: #EEEDFE; color: #534AB7; font-size: 11px; font-weight: 600; }
.ai-compare-summary { padding: 12px 16px; background: #f8f9fa; border-radius: var(--radius-sm); font-size: 13px; color: var(--gray-700); margin-bottom: 16px; }
.ai-supplier-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); margin-bottom: 8px; }
.ai-supplier-score { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; flex-shrink: 0; }
.ai-supplier-score.high { background: var(--success-bg); color: var(--success); }
.ai-supplier-score.medium { background: var(--warning-bg); color: var(--warning); }
.ai-supplier-score.low { background: #fee2e2; color: #c5221f; }
.ai-supplier-info { flex: 1; }
.ai-supplier-name { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 4px; }
.ai-supplier-pros-cons { display: flex; gap: 16px; font-size: 12px; }
.ai-supplier-pros { color: var(--success); }
.ai-supplier-cons { color: var(--warning); }
.ai-recommendation { padding: 16px; background: linear-gradient(135deg, #e8f0fe, #f0f7ff); border-radius: var(--radius-sm); border-left: 4px solid var(--primary); margin-top: 12px; }
.ai-recommendation-title { font-size: 14px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.ai-recommendation-reason { font-size: 13px; color: var(--gray-600); }

/* ===== Merchant PO & Stock Tabs ===== */
.merchant-po-list { display: flex; flex-direction: column; gap: 12px; }
.merchant-po-filters { display: flex; gap: 8px; margin-bottom: 16px; }
.merchant-po-filter-btn { padding: 6px 14px; border-radius: var(--radius-xs); border: 1px solid var(--border-color); background: var(--white); font-size: 12px; cursor: pointer; transition: all 0.2s; }
.merchant-po-filter-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.merchant-po-filter-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.stock-prep-card { background: var(--white); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 12px; }
.stock-prep-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.stock-prep-items { display: flex; flex-direction: column; gap: 6px; }
.stock-prep-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--gray-100); }
.stock-prep-item:last-child { border-bottom: none; }
.stock-prep-status { display: flex; gap: 8px; }
.stock-prep-btn { padding: 6px 14px; border-radius: var(--radius-xs); font-size: 12px; cursor: pointer; border: 1px solid var(--border-color); background: var(--white); transition: all 0.2s; }
.stock-prep-btn.primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.stock-prep-btn.success { background: var(--success); color: var(--white); border-color: var(--success); }

/* ===== Customer Portal: Order Center & Comparison ===== */
.customer-order-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 12px; cursor: pointer; transition: all 0.2s; border: 1px solid var(--border-color); }
.customer-order-card:hover { border-color: var(--primary); box-shadow: 0 2px 12px rgba(25,103,210,0.1); }
.customer-order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.customer-order-no { font-size: 15px; font-weight: 700; color: var(--gray-800); }
.customer-order-info { font-size: 13px; color: var(--gray-500); display: flex; gap: 12px; }
.customer-order-progress { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--gray-100); }
.progress-bar { flex: 1; height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }
.progress-label { font-size: 12px; color: var(--gray-400); }

/* ===== Freight Forwarder Workspace ===== */
.ff-workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ff-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.ff-card h4 { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); }
.ff-contact-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.ff-contact-row:last-child { border-bottom: none; }
.ff-contact-label { font-size: 12px; color: var(--gray-400); }
.ff-contact-value { font-size: 13px; font-weight: 500; color: var(--gray-800); }
.ff-customs-check { padding: 12px; background: #f8f9fa; border-radius: var(--radius-sm); margin-top: 8px; }
.ff-customs-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.ff-customs-item .check-icon { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.ff-customs-item.ok .check-icon { background: var(--success-bg); color: var(--success); }
.ff-customs-item.warn .check-icon { background: var(--warning-bg); color: var(--warning); }

/* ===== AI Config Panel ===== */
.ai-config-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; margin-bottom: 16px; }
.ai-config-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.ai-config-row:last-child { border-bottom: none; }
.ai-config-label { font-size: 13px; color: var(--gray-600); }
.ai-config-value { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.ai-toggle { position: relative; width: 36px; height: 20px; background: var(--gray-300); border-radius: 10px; cursor: pointer; transition: background 0.2s; }
.ai-toggle.on { background: var(--primary); }
.ai-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); transition: transform 0.2s; }
.ai-toggle.on::after { transform: translateX(16px); }
.ai-scenario-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.ai-scenario-item { padding: 10px 12px; background: #f8f9fa; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 8px; }
.ai-scenario-icon { font-size: 18px; }
.ai-scenario-name { font-size: 12px; font-weight: 500; color: var(--gray-700); }
.ai-scenario-desc { font-size: 11px; color: var(--gray-400); }

/* ===== Customer Portal Tabs ===== */
.customer-tabs { display: flex; gap: 0; border-bottom: 1px solid #e8eaed; padding: 0 12px; flex-shrink: 0; }
.customer-tabs .ctab { padding: 8px 14px; border: none; background: none; cursor: pointer; font-size: 12px; font-weight: 500; color: var(--gray-500); border-radius: 6px 6px 0 0; transition: all .2s; }
.customer-tabs .ctab:hover { color: var(--gray-700); background: #f1f3f4; }
.customer-tabs .ctab.active { color: #fff; background: var(--primary); }
.ctab-content { display: none; flex: 1; min-height: 0; overflow: hidden; flex-direction: column; }
.ctab-content.active { display: flex; }

/* ===== Customer Order Cards ===== */
.customer-order-list { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.customer-order-card { background: #fff; border: 1px solid #e8eaed; border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; transition: box-shadow .2s, border-color .2s; }
.customer-order-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.customer-order-card .co-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.customer-order-card .co-no { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.customer-order-card .co-amount { font-size: 14px; font-weight: 700; color: var(--primary); }
.customer-order-card .co-meta { display: flex; gap: 12px; font-size: 11px; color: var(--gray-400); margin-bottom: 6px; }
.customer-order-card .co-meta span { display: inline-flex; align-items: center; gap: 3px; }
.customer-order-card .co-timeline { display: flex; align-items: center; gap: 2px; margin-top: 4px; }
.co-step { display: flex; align-items: center; gap: 2px; font-size: 10px; color: var(--gray-400); }
.co-step .dot { width: 8px; height: 8px; border-radius: 50%; background: #e0e0e0; }
.co-step.done .dot { background: var(--primary); }
.co-step.current .dot { background: var(--warning); box-shadow: 0 0 0 3px rgba(252,165,3,.2); }
.co-step .bar { width: 16px; height: 2px; background: #e0e0e0; }
.co-step.done .bar { background: var(--primary); }
.co-step-label { white-space: nowrap; }

/* ===== Customer Document Cards ===== */
.customer-doc-list { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.customer-doc-card { background: #fff; border: 1px solid #e8eaed; border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; transition: box-shadow .2s, border-color .2s; }
.customer-doc-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.customer-doc-card .cd-header { display: flex; justify-content: space-between; align-items: center; }
.customer-doc-card .cd-no { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.customer-doc-card .cd-type { font-size: 11px; padding: 2px 8px; border-radius: var(--radius-tag); background: #e8f0fe; color: var(--primary); }
.customer-doc-card .cd-meta { display: flex; gap: 12px; font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* ===== Customer Order Detail Modal ===== */
.order-detail-modal { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.4); }
.order-detail-modal.show { display: flex; }
.order-detail-modal .odm-content { background: #fff; border-radius: var(--radius); max-width: 640px; width: 90%; max-height: 80vh; overflow-y: auto; }
.order-detail-modal .odm-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e8eaed; }
.order-detail-modal .odm-title { font-size: 16px; font-weight: 600; color: var(--gray-800); }
.order-detail-modal .odm-close { cursor: pointer; font-size: 20px; color: var(--gray-400); background: none; border: none; }
.order-detail-modal .odm-body { padding: 20px; }
.order-detail-modal .odm-timeline { display: flex; flex-direction: column; gap: 0; }
.odm-timeline-item { display: flex; gap: 12px; padding-bottom: 20px; position: relative; }
.odm-timeline-item:last-child { padding-bottom: 0; }
.odm-timeline-item .oti-dot { width: 12px; height: 12px; border-radius: 50%; background: #e0e0e0; flex-shrink: 0; margin-top: 2px; }
.odm-timeline-item.done .oti-dot { background: var(--primary); }
.odm-timeline-item.current .oti-dot { background: var(--warning); box-shadow: 0 0 0 4px rgba(252,165,3,.2); }
.odm-timeline-item:not(:last-child)::after { content: ''; position: absolute; left: 5px; top: 16px; bottom: 0; width: 2px; background: #e8eaed; }
.odm-timeline-item.done:not(:last-child)::after { background: var(--primary); }
.odm-timeline-item .oti-info { flex: 1; }
.odm-timeline-item .oti-label { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.odm-timeline-item .oti-time { font-size: 11px; color: var(--gray-400); }
.odm-timeline-item .oti-note { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* PO Generate Confirm Button */
.quote-confirm-po { margin-top: 6px; padding: 4px 10px; font-size: 11px; font-weight: 600; color: #fff; background: var(--primary); border: none; border-radius: var(--radius-tag); cursor: pointer; }
.quote-confirm-po:hover { opacity: .85; }

/* AI Compare result modal */
.ai-compare-result { max-width: 580px; width: 90%; max-height: 80vh; overflow-y: auto; background: #fff; border-radius: var(--radius); }
.ai-compare-result .acr-header { padding: 16px 20px; border-bottom: 1px solid #e8eaed; display: flex; justify-content: space-between; align-items: center; }
.ai-compare-result .acr-body { padding: 20px; }
.ai-compare-result .acr-summary { font-size: 13px; color: var(--gray-700); margin-bottom: 12px; line-height: 1.5; }
.ai-compare-result .acr-supplier { padding: 12px; border: 1px solid #e8eaed; border-radius: var(--radius-sm); margin-bottom: 8px; }
.ai-compare-result .acr-supplier-name { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.ai-compare-result .acr-supplier-score { font-size: 12px; font-weight: 700; color: var(--primary); }
.ai-compare-result .acr-pros-cons { font-size: 11px; color: var(--gray-500); display: flex; gap: 16px; }
.ai-compare-result .acr-pros { color: #2e7d32; }
.ai-compare-result .acr-cons { color: #c62828; }
.ai-compare-result .acr-recommendation { padding: 12px; background: #e8f0fe; border-radius: var(--radius-sm); margin-top: 8px; }
.ai-compare-result .acr-rec-title { font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.ai-compare-result .acr-reason { font-size: 12px; color: var(--gray-700); line-height: 1.5; }

/* ============ PO PDF Template (VSL-CENT-2026-0081 style) ============ */
.po-pdf {
  padding: 24px 28px;
  background: #fff;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #222;
  font-size: 12px;
  line-height: 1.55;
  max-width: 920px;
  margin: 0 auto;
}
.po-pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #1967d2;
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.po-pdf-company-name {
  font-size: 18px;
  font-weight: 700;
  color: #1967d2;
  margin-bottom: 4px;
}
.po-pdf-company-tag {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #333;
}
.po-pdf-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e8eaed;
  font-size: 13px;
  margin-bottom: 12px;
}
.po-pdf-label {
  color: #888;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-right: 4px;
}
.po-pdf-section {
  padding: 12px 0;
  margin-bottom: 12px;
}
.po-pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 11px;
  background: #fff;
  border: 1px solid #d0d0d0;
}
.po-pdf-table th {
  background: #f0f4f8;
  color: #444;
  font-weight: 600;
  padding: 8px 6px;
  border: 1px solid #d0d0d0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.po-pdf-table td {
  padding: 6px;
  border: 1px solid #e0e0e0;
  vertical-align: top;
}
.po-pdf-table tbody tr:nth-child(even) {
  background: #fafbfc;
}
.po-pdf-summary {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 320px;
}
.po-pdf-summary td {
  padding: 6px 12px;
  border: 1px solid #e0e0e0;
}
.po-pdf-summary td:first-child {
  background: #f8f9fa;
  color: #555;
  font-weight: 500;
}
.po-pdf-block {
  background: #fafbfc;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 8px 0;
}
.po-pdf-block-title {
  font-weight: 600;
  color: #444;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  border-bottom: 1px solid #e8eaed;
  padding-bottom: 4px;
}
.po-pdf-block-body {
  font-size: 12px;
  color: #333;
  white-space: pre-wrap;
}
.po-pdf-row-2col {
  display: flex;
  gap: 12px;
}
.po-pdf-terms {
  margin: 0;
  padding-left: 20px;
  font-size: 11px;
  color: #555;
  line-height: 1.6;
}
.po-pdf-terms li {
  margin-bottom: 4px;
}
.po-pdf-footer {
  display: flex;
  justify-content: space-between;
  gap: 60px;
  margin-top: 32px;
  padding-top: 12px;
}
.po-pdf-signature {
  flex: 1;
  text-align: center;
}
.po-pdf-signature-line {
  border-top: 1px solid #888;
  margin-bottom: 4px;
  height: 36px;
}
.po-pdf-signature-label {
  font-size: 11px;
  font-weight: 600;
  color: #333;
}
.po-pdf-signature-role {
  font-size: 10px;
  color: #888;
  margin-top: 2px;
}
.po-pdf-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 0 8px;
  margin-top: 12px;
  border-top: 1px solid #e8eaed;
}
.po-pdf-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 16px;
  margin: 12px 0;
}
.po-pdf-edit-grid label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: #666;
  font-weight: 500;
}
.po-pdf-edit-grid input,
.po-pdf-edit-grid select,
.po-pdf-edit-grid textarea {
  margin-top: 4px;
  padding: 6px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #222;
  transition: border-color 0.15s;
}
.po-pdf-edit-grid input:focus,
.po-pdf-edit-grid select:focus,
.po-pdf-edit-grid textarea:focus {
  outline: none;
  border-color: #1967d2;
  box-shadow: 0 0 0 3px rgba(25, 103, 210, 0.1);
}
.po-pdf-table input {
  padding: 4px 6px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
}
.po-pdf-table input:focus {
  outline: none;
  border-color: #1967d2;
}
.po-pdf-summary input {
  padding: 4px 6px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
}
.btn-icon-danger {
  background: #fee;
  border: 1px solid #fcc;
  color: #c62828;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: all 0.15s;
}
.btn-icon-danger:hover {
  background: #fcc;
  border-color: #c62828;
}
.btn-primary {
  background: #1967d2;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary:hover {
  background: #1557b0;
}
.btn-secondary {
  background: #f1f3f4;
  color: #333;
  border: 1px solid #dadce0;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover {
  background: #e8eaed;
}
@media (max-width: 768px) {
  .po-pdf { padding: 16px; }
  .po-pdf-edit-grid { grid-template-columns: 1fr; }
  .po-pdf-row-2col { flex-direction: column; }
  .po-pdf-footer { flex-direction: column; gap: 24px; }
  .po-pdf-table { font-size: 10px; }
  .po-pdf-table th, .po-pdf-table td { padding: 4px 3px; }
}

/* ===== Trade Document Templates ===== */
.doc-tpl {
  font-family: "Inter", sans-serif;
  font-size: 12px;
  color: #222;
  line-height: 1.55;
  max-width: 880px;
  margin: 0 auto;
}
.doc-tpl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #1967d2;
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.doc-tpl-company {
  font-size: 16px;
  font-weight: 700;
  color: #1967d2;
  margin-bottom: 2px;
}
.doc-tpl-company-addr {
  font-size: 10px;
  color: #666;
  line-height: 1.4;
  max-width: 380px;
}
.doc-tpl-company-contact {
  font-size: 10px;
  color: #888;
  margin-top: 2px;
}
.doc-tpl-subtitle {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #333;
  margin-top: 2px;
}
.doc-tpl-meta {
  text-align: right;
  font-size: 11px;
  color: #888;
  line-height: 1.8;
}
.doc-tpl-meta strong { color: #333; }
.doc-tpl-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid #e8eaed;
  margin-bottom: 10px;
}
.doc-tpl-party-label {
  font-size: 10px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}
.doc-tpl-party-name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}
.doc-tpl-party-addr {
  font-size: 11px;
  color: #666;
  white-space: pre-wrap;
}
.doc-tpl-party-line {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.doc-tpl-info-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px 16px;
  font-size: 11px;
  padding: 8px 0;
  border-bottom: 1px solid #e8eaed;
  margin-bottom: 10px;
}
.doc-tpl-field-label {
  font-size: 10px;
  color: #888;
  font-weight: 500;
  margin-right: 2px;
}
.doc-tpl-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 11px;
  border: 1px solid #d0d0d0;
}
.doc-tpl-table th {
  background: #f0f4f8;
  color: #444;
  font-weight: 600;
  padding: 7px 5px;
  border: 1px solid #d0d0d0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.doc-tpl-table td {
  padding: 5px 6px;
  border: 1px solid #e0e0e0;
  vertical-align: top;
}
.doc-tpl-table tbody tr:nth-child(even) { background: #fafbfc; }
.doc-tpl-table tfoot td {
  padding: 6px 8px;
  border: 1px solid #d0d0d0;
  font-size: 11px;
}
.doc-tpl-bottom {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  margin-top: 20px;
}
.doc-tpl-payment {
  flex: 1;
  background: #fafbfc;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  padding: 10px 14px;
}
.doc-tpl-block-title {
  font-weight: 600;
  color: #444;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  border-bottom: 1px solid #e8eaed;
  padding-bottom: 4px;
}
.doc-tpl-block-body {
  font-size: 11px;
  color: #333;
  line-height: 1.7;
}
.doc-tpl-signature {
  min-width: 200px;
  text-align: center;
}
.doc-tpl-sig-line {
  border-top: 1px solid #888;
  margin-top: 36px;
  padding-top: 3px;
}
.doc-tpl-sig-label {
  font-size: 10px;
  font-weight: 600;
  color: #333;
  margin-top: 2px;
}
.doc-tpl-delivery-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid #e8eaed;
  margin-bottom: 10px;
}
.doc-tpl-dp-block {
  background: #fafbfc;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  padding: 8px 12px;
}
.doc-tpl-dp-label {
  font-size: 10px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.doc-tpl-dp-name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}
.doc-tpl-dp-line {
  font-size: 11px;
  color: #666;
  line-height: 1.6;
}
.doc-tpl-signatures-dual {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #e8eaed;
}
.doc-tpl-sig-block {
  flex: 1;
  text-align: center;
}
.doc-tpl-sig-block-label {
  font-size: 10px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.doc-tpl-remarks-block {
  margin-top: 16px;
  background: #fafbfc;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  padding: 10px 14px;
}
.doc-tpl-remarks-list {
  margin: 4px 0 0;
  padding-left: 16px;
  font-size: 11px;
  color: #555;
  line-height: 1.7;
}
.doc-tpl-remarks-list li { margin-bottom: 3px; }
.doc-tpl-remarks {
  margin-top: 12px;
  font-size: 11px;
  color: #555;
  padding: 8px 12px;
  background: #fafbfc;
  border-radius: 6px;
}
.doc-tpl-marks {
  margin-top: 12px;
  background: #fafbfc;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  padding: 8px 14px;
}
@media (max-width: 768px) {
  .doc-tpl-parties, .doc-tpl-delivery-parties, .doc-tpl-info-row { grid-template-columns: 1fr; }
  .doc-tpl-bottom, .doc-tpl-signatures-dual { flex-direction: column; gap: 16px; }
  .doc-tpl-table { font-size: 10px; }
  .doc-tpl-table th, .doc-tpl-table td { padding: 4px 3px; }
}

/* ===== RTL Support for Arabic (العربية) ===== */
/* When <html dir="rtl"> is set, adjust key layout elements */
[dir="rtl"] body { text-align: right; }

/* Nav bar: swap left/right padding */
[dir="rtl"] .nav-bar { direction: rtl; }
[dir="rtl"] .nav-left { flex-direction: row-reverse; }

/* Drawer: slide from right instead of left */
[dir="rtl"] .side-drawer { right: auto; left: -320px; transition: left .3s ease; }
[dir="rtl"] .side-drawer.open { left: 0; }
[dir="rtl"] .drawer-overlay { direction: rtl; }

/* Cards & panels: swap internal alignment */
[dir="rtl"] .panel-header,
[dir="rtl"] .card-header { flex-direction: row-reverse; }

/* Timeline: reverse direction */
[dir="rtl"] .order-timeline { direction: rtl; }
[dir="rtl"] .timeline-node { flex-direction: row-reverse; }

/* Tables: keep LTR for data clarity (part numbers, prices) */
[dir="rtl"] .data-table { direction: ltr; text-align: left; }
[dir="rtl"] .data-table th { text-align: center; }

/* Form inputs: align text right */
[dir="rtl"] input[type="text"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="password"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] textarea,
[dir="rtl"] select { text-align: right; direction: rtl; }

/* Buttons: keep LTR for icon alignment */
[dir="rtl"] .btn,
[dir="rtl"] .btn-primary,
[dir="rtl"] .btn-secondary,
[dir="rtl"] .btn-outline { direction: rtl; }

/* Chat panel: swap message alignment */
[dir="rtl"] .chat-message-user { text-align: right; }
[dir="rtl"] .chat-message-bot { text-align: right; }

/* Modals: center content but align text right */
[dir="rtl"] .modal-body,
[dir="rtl"] .modal-content { direction: rtl; text-align: right; }

/* Status badges: keep LTR for consistency */
[dir="rtl"] .status-badge,
[dir="rtl"] .po-status-badge { direction: ltr; }

/* Flex layouts: auto-reverse for common patterns */
[dir="rtl"] .flex-row-reverse-rtl { flex-direction: row-reverse; }

/* PO PDF template: keep LTR for trade document clarity */
[dir="rtl"] .po-pdf-template,
[dir="rtl"] .po-pdf-actions { direction: ltr; text-align: left; }

/* Quick action buttons: keep grid LTR */
[dir="rtl"] .quick-actions { direction: ltr; }

/* Search boxes: align right */
[dir="rtl"] .search-box input { text-align: right; }

/* Notification items: swap alignment */
[dir="rtl"] .notif-item { flex-direction: row-reverse; }

/* Pagination: keep LTR */
[dir="rtl"] .pagination { direction: ltr; }

/* ===== PO-UNIFIED-001: PO 进度圆点 3 态样式（公共组件 po-common.js） ===== */
/* 客户端订单卡片 + 商家端订单列表共用，渲染由 window.POCommon.renderPOProgressDots 输出 */
.po-progress {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  margin: 8px 0;
}
.po-progress-step {
  display: flex;
  align-items: center;
  flex: 1;
  cursor: help;
}
.po-progress-step:last-child {
  flex: 0;
}
.po-progress-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #dadce0;
  background: #fff;
  flex-shrink: 0;
  transition: all .15s ease;
}
.po-progress-step.done .po-progress-dot {
  background: #165DFF;   /* 已完成：蓝色实心 */
  border-color: #165DFF;
}
.po-progress-step.current .po-progress-dot {
  background: #FF7D00;   /* 当前节点：橙色高亮 */
  border-color: #FF7D00;
  box-shadow: 0 0 0 4px rgba(255, 125, 0, 0.15);
}
.po-progress-bar {
  flex: 1;
  height: 2px;
  background: #dadce0;
  margin: 0 4px;
}
.po-progress-step.done .po-progress-bar {
  background: #165DFF;
}
/* PO 状态徽章容器（列表卡片内） */
.po-status-wrap { display: inline-flex; align-items: center; }

/* ===== PO 状态徽章配色补充 ===== */
/* renderPOStatusBadge 对 in_transit 输出 po-status-in-transit（连字符），
   现有 CSS 仅有 po-status-in_transit（下划线，用于状态历史），此处补连字符版本，
   配色与下划线版本保持一致，确保同一状态双端同色。其余状态配色已在上方定义，不重复。 */
.po-status-in-transit { background: #e8f0fe; color: var(--primary-dark); }

/* ===== PO-DETAILS-001: 卡片 hover 边框高亮 + pointer 手型 ===== */
/* 客户端 .customer-order-card + 商家端 .po-card 共用；置于文件末尾以覆盖既有 hover 规则 */
.customer-order-card, .po-card {
  cursor: pointer;
  transition: all .15s ease;
  border: 1px solid var(--border-color);
}
.customer-order-card:hover, .po-card:hover {
  border-color: #165DFF;
  box-shadow: 0 4px 16px rgba(22, 93, 255, 0.12);
  transform: translateY(-1px);
}

/* ===== PO-DETAILS-001: Details/详情 次要按钮 ===== */
.co-details-btn, .po-details-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #165DFF;
  background: #fff;
  border: 1px solid #165DFF;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.co-details-btn:hover, .po-details-btn:hover {
  background: #165DFF;
  color: #fff;
  box-shadow: 0 2px 8px rgba(22, 93, 255, 0.2);
}

/* ===== PO-DETAILS-001: 卡片头部 actions 容器 ===== */
.co-header-actions, .po-card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== PO-DETAILS-001: 移动端响应式（< 768px）垂直分层排版 ===== */
@media (max-width: 768px) {
  /* PO 卡片改为垂直分层排版 */
  .customer-order-card, .po-card {
    padding: 12px;
  }
  .co-header, .po-card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }
  .co-header-actions, .po-card-header-right {
    width: 100%;
    justify-content: space-between;
  }
  .co-meta, .po-card-meta {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 4px;
  }
  .co-timeline, .po-progress {
    margin: 8px 0;
  }
  /* 进度圆点缩小 */
  .po-progress-dot {
    width: 10px;
    height: 10px;
  }
  /* Details 按钮移动端更大 */
  .co-details-btn, .po-details-btn {
    padding: 6px 14px;
    font-size: 13px;
  }
}

/* ============================================================
   Maya AI-Customer Service — Component Styles (appended)
   All colors via CSS vars. No hardcoded hex (#fff/#000 exempt).
   ============================================================ */

/* ---- Launcher FAB ---- */
.cs-launcher {
  position: fixed;
  bottom: var(--offset-edge);
  right: var(--offset-edge);
  z-index: var(--z-launcher);
  width: var(--launcher-size);
  height: var(--launcher-size);
  border-radius: var(--radius-pill);
  background: var(--maya-brand);
  color: var(--on-brand);
  box-shadow: var(--shadow-launcher);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--motion-fast) var(--ease-standard),
              transform var(--motion-fast) var(--ease-standard),
              box-shadow var(--motion-fast) var(--ease-standard);
}
.cs-launcher:hover { background: var(--maya-brand-hover); transform: translateY(-2px); }
.cs-launcher:active { background: var(--maya-brand-active); transform: translateY(0); }
.cs-launcher:focus-visible { outline: none; box-shadow: var(--shadow-launcher), var(--focus-ring); }

/* Unread badge */
.cs-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: var(--on-brand);
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  border: 2px solid var(--surface);
}

/* ---- Widget root (fixed position shell) ---- */
.cs-widget-root {
  position: fixed;
  bottom: var(--offset-edge);
  right: var(--offset-edge);
  z-index: var(--z-widget);
  flex-direction: row;
  animation: csSlideUp var(--motion-slow) var(--ease-standard);
}
@keyframes csSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Widget container ---- */
.cs-widget {
  width: var(--widget-width);
  max-height: 520px;
  height: var(--widget-height);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-widget);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cs-widget--with-sidebar { width: var(--widget-width-with-sidebar); }

/* Minimized state: only header visible */
.cs-widget--minimized .cs-header ~ *,
.cs-widget--minimized .cs-sidebar {
  display: none !important;
}
.cs-widget--minimized {
  height: auto !important;
  max-height: 52px;
}

/* ---- Header (draggable) ---- */
.cs-header {
  cursor: move;
  user-select: none;
}

/* ---- Sidebar (P1) ---- */
.cs-sidebar {
  width: var(--sidebar-width);
  background: var(--bg);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}
.cs-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--border-soft);
}
.cs-sidebar-title {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cs-sidebar-search {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  margin: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}
.cs-sidebar-search-input {
  border: none;
  background: transparent;
  font-size: var(--text-caption);
  color: var(--fg);
  width: 100%;
  outline: none;
}
.cs-sidebar-search-input::placeholder { color: var(--placeholder); }
.cs-session-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-1);
}
.cs-session-empty {
  font-size: var(--text-caption);
  color: var(--fg-tertiary);
  text-align: center;
  padding: var(--space-6) var(--space-2);
  line-height: 1.5;
}

/* Conversation item */
.cs-conv-item {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--motion-fast) var(--ease-standard);
}
.cs-conv-item:hover { background: var(--maya-brand-lighter); }
.cs-conv-item--active { background: var(--maya-brand-light); }
.cs-conv-title {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--fg);
  width: calc(100% - 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: var(--space-2);
}
.cs-conv-time {
  font-size: 10px;
  color: var(--fg-tertiary);
  width: 100%;
  margin-top: 2px;
}
.cs-conv-del {
  position: absolute;
  right: var(--space-1);
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--fg-tertiary);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.cs-conv-item:hover .cs-conv-del { opacity: 1; }
.cs-conv-del:hover { color: var(--danger); }

/* ---- Main chat column ---- */
.cs-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ---- Header ---- */
.cs-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 52px;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.cs-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--maya-brand);
  color: var(--on-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cs-header-text { flex: 1; min-width: 0; }
.cs-header-title {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cs-header-status {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-caption);
  color: var(--muted);
}
.cs-status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--success);
  flex-shrink: 0;
}

/* Icon button */
.cs-icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.cs-icon-btn:hover { background: var(--maya-brand-lighter); color: var(--maya-brand); }
.cs-icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---- Error banner ---- */
.cs-error-banner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: #fef7f7;
  border-bottom: 1px solid #f4d3cf;
  color: var(--danger);
  font-size: var(--text-caption);
  flex-shrink: 0;
}
.cs-error-banner span { flex: 1; }

/* ---- Message area ---- */
.cs-message-area {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.cs-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 100%;
}
.cs-msg-row--user { align-items: flex-end; }
.cs-msg-row--ai { align-items: flex-start; }

/* Message bubbles */
.cs-bubble--ai {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  max-width: 75%;
  font-size: var(--text-small);
  line-height: 1.5;
  word-break: break-word;
}
.cs-bubble--user {
  background: var(--maya-brand);
  color: var(--on-brand);
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  max-width: 75%;
  font-size: var(--text-small);
  line-height: 1.5;
  word-break: break-word;
}
.cs-bubble--typing {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.cs-msg-meta {
  font-size: 10px;
  color: var(--fg-tertiary);
  margin-top: var(--space-1);
  padding: 0 var(--space-1);
}

/* Typing dots */
.cs-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--fg-tertiary);
  animation: csTypingBounce 1.2s var(--ease-standard) infinite;
}
.cs-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.cs-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes csTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Feedback button (P0 AC-10) ---- */
.cs-feedback { margin-top: var(--space-1); }
.cs-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: var(--text-caption);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.cs-feedback-btn:hover { background: var(--maya-brand-lighter); color: var(--maya-brand); border-color: var(--maya-brand); }

/* ---- Escalate prompt card ---- */
.cs-escalate-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--maya-brand-lighter);
  border: 1px solid var(--maya-brand-light);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  max-width: 85%;
  flex-wrap: wrap;
}
.cs-escalate-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-caption);
  padding: var(--space-1) var(--space-3);
}

/* ---- Quick replies (P1) ---- */
.cs-quick-replies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.cs-quick-reply {
  background: var(--maya-brand-light);
  border: 1px solid var(--maya-brand);
  color: var(--maya-brand);
  font-weight: 500;
  font-size: var(--text-caption);
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
  height: 32px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--motion-fast) var(--ease-standard);
}
.cs-quick-reply:hover { background: var(--maya-brand-lighter); }
.cs-quick-reply:active { background: var(--maya-brand); color: var(--on-brand); }
.cs-quick-reply:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---- Input bar ---- */
.cs-input-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.cs-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-small);
  color: var(--fg);
  width: 100%;
  resize: none;
  outline: none;
  font-family: var(--font-body);
  line-height: 1.4;
  transition: border-color var(--motion-fast) var(--ease-standard),
              box-shadow var(--motion-fast) var(--ease-standard);
}
.cs-input::placeholder { color: var(--placeholder); }
.cs-input:focus { border-color: var(--maya-brand); box-shadow: var(--focus-ring); }
.cs-input--error { border-color: var(--danger); }
.cs-send-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--maya-brand);
  color: var(--on-brand);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--motion-fast) var(--ease-standard);
}
.cs-send-btn:hover { background: var(--maya-brand-hover); }
.cs-send-btn:active { background: var(--maya-brand-active); }
.cs-send-btn:disabled { background: var(--border); color: var(--fg-tertiary); cursor: not-allowed; }
.cs-send-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---- Human support bar (collapsible, v4.68) ---- */
.cs-human-support-bar {
  padding: 0;
  background: var(--bg);
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.cs-hs-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard);
}
.cs-hs-toggle:hover { background: var(--maya-brand-lighter); color: var(--maya-brand); }
.cs-hs-toggle[aria-expanded="true"] .cs-hs-chevron { transform: rotate(180deg); }
.cs-hs-chevron { transition: transform var(--motion-fast) var(--ease-standard); }
.cs-hs-contacts {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border-soft);
}
.cs-hs-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-caption);
  color: var(--maya-brand);
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-standard);
}
.cs-hs-link:hover { color: var(--maya-brand-hover); text-decoration: underline; }

/* ---- Primary + Ghost buttons ---- */
.cs-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  background: var(--maya-brand);
  color: var(--on-brand);
  border: none;
  border-radius: var(--radius-md);
  padding: 10px var(--space-4);
  font-weight: 500;
  font-size: var(--text-small);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard);
}
.cs-btn-primary:hover { background: var(--maya-brand-hover); }
.cs-btn-primary:active { background: var(--maya-brand-active); }
.cs-btn-primary:disabled { background: var(--border); color: var(--fg-tertiary); cursor: not-allowed; }
.cs-btn-primary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cs-btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-md);
  padding: 10px var(--space-4);
  font-weight: 500;
  font-size: var(--text-small);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}
.cs-btn-ghost:hover { background: var(--bg); border-color: var(--maya-brand); color: var(--maya-brand); }

/* ============================================================
   Ticket Modal (P1)
   ============================================================ */
.cs-ticket-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cs-ticket-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.cs-ticket-modal-box {
  position: relative;
  width: 480px;
  max-width: 92vw;
  max-height: 80vh;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: csModalIn var(--motion-slow) var(--ease-standard);
}
@keyframes csModalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.cs-ticket-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-soft);
}
.cs-ticket-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--fg);
}
.cs-ticket-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.cs-ticket-section { display: flex; flex-direction: column; gap: var(--space-2); }
.cs-ticket-section-label {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cs-ticket-chat-summary {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  max-height: 200px;
  overflow-y: auto;
  font-size: var(--text-caption);
  line-height: 1.5;
}
.cs-ticket-summary-row { margin-bottom: var(--space-2); color: var(--muted); }
.cs-ticket-summary-who { font-weight: 500; color: var(--fg); }
.cs-ticket-empty { color: var(--fg-tertiary); font-size: var(--text-caption); text-align: center; padding: var(--space-4); }
.cs-ticket-textarea { min-height: 72px; resize: vertical; }
.cs-char-count { font-size: 10px; color: var(--fg-tertiary); text-align: right; }
.cs-priority-chips { display: flex; gap: var(--space-2); }
.cs-priority-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 500;
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
  height: 30px;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}
.cs-priority-chip:hover { border-color: var(--maya-brand); color: var(--maya-brand); }
.cs-priority-chip.active { background: var(--maya-brand); border-color: var(--maya-brand); color: var(--on-brand); }
.cs-ticket-contact { font-size: var(--text-small); color: var(--fg); }
.cs-ticket-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-soft);
}

/* ============================================================
   Admin CS Ticket page styles
   ============================================================ */
.cs-filter-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--text-small);
  border-radius: var(--radius-pill);
  padding: 5px var(--space-3);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}
.cs-filter-tab:hover { border-color: var(--maya-brand); color: var(--maya-brand); }
.cs-filter-tab.active { background: var(--maya-brand); border-color: var(--maya-brand); color: var(--on-brand); }
.cs-admin-search {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 5px var(--space-3);
  font-size: var(--text-small);
  color: var(--fg);
  outline: none;
  min-width: 180px;
}
.cs-admin-search:focus { border-color: var(--maya-brand); box-shadow: var(--focus-ring); }
.cs-admin-loading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: center;
  padding: var(--space-12);
  color: var(--muted);
  font-size: var(--text-small);
}
.cs-admin-loading i { animation: csSpin 1s linear infinite; }
@keyframes csSpin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.cs-admin-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-12);
  color: var(--fg-tertiary);
  text-align: center;
}
.cs-admin-empty-sub { font-size: var(--text-small); color: var(--fg-tertiary); max-width: 320px; }
.cs-admin-table-wrap { overflow-x: auto; }
.cs-admin-table { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
.cs-admin-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.cs-admin-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-soft);
  color: var(--fg);
  vertical-align: middle;
}
.cs-admin-table tr:hover td { background: var(--maya-brand-lighter); }
.cs-admin-mono { font-family: var(--font-mono); font-size: var(--text-caption); color: var(--muted); }
.cs-admin-view-btn {
  background: var(--maya-brand-light);
  border: 1px solid var(--maya-brand);
  color: var(--maya-brand);
  font-size: var(--text-caption);
  border-radius: var(--radius-sm);
  padding: 3px var(--space-2);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard);
}
.cs-admin-view-btn:hover { background: var(--maya-brand); color: var(--on-brand); }
.cs-admin-pager {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: center;
  padding: var(--space-3);
  color: var(--muted);
  font-size: var(--text-small);
}
.cs-admin-pager button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--radius-md);
  padding: 4px var(--space-3);
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-standard);
}
.cs-admin-pager button:hover { border-color: var(--maya-brand); color: var(--maya-brand); }
.cs-admin-link { color: var(--maya-brand); text-decoration: none; }
.cs-admin-link:hover { text-decoration: underline; }

/* Priority + status badges */
.cs-pri-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}
.cs-pri-normal { background: var(--border-soft); color: var(--muted); }
.cs-pri-urgent { background: #fef3e0; color: #b06000; }
.cs-pri-critical { background: #fce8e6; color: var(--danger); }
.cs-status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: capitalize;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}
.cs-status-open { background: var(--maya-brand-light); color: var(--maya-brand); }
.cs-status-in-progress { background: #fef3e0; color: #b06000; }
.cs-status-resolved { background: #e6f4ea; color: var(--success); }
.cs-status-closed { background: var(--border-soft); color: var(--muted); }

/* Ticket detail modal */
.cs-ticket-detail { display: flex; flex-direction: column; gap: var(--space-3); }
.cs-ticket-detail-row {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-small);
  align-items: center;
}
.cs-ticket-detail-row label {
  min-width: 80px;
  color: var(--muted);
  font-weight: 600;
  font-size: var(--text-caption);
}
.cs-ticket-detail-section { display: flex; flex-direction: column; gap: var(--space-2); }
.cs-ticket-detail-section > label { color: var(--muted); font-weight: 600; font-size: var(--text-caption); }
.cs-ticket-detail-note {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-small);
  line-height: 1.5;
  color: var(--fg);
}
.cs-ticket-detail-chat {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  max-height: 300px;
  overflow-y: auto;
  font-size: var(--text-caption);
  line-height: 1.6;
}
.cs-ticket-status-update {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.cs-ticket-status-update label { font-size: var(--text-caption); color: var(--muted); font-weight: 600; }

/* ---- A11y guards ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ============================================================
   Responsive — Maya CS Widget
   ============================================================ */
/* Desktop: sidebar hidden by default, toggled via menu */
.cs-mobile-only { display: none; }

@media (min-width: 769px) {
  .cs-sidebar { display: none; }
  .cs-widget--with-sidebar .cs-sidebar { display: flex; }
  #csSidebarToggleDesktop { display: flex !important; }
}

/* Tablet: widget 360x520, sidebar drawer */
@media (max-width: 768px) and (min-width: 481px) {
  .cs-widget-root .cs-widget {
    width: 360px;
    height: 520px;
  }
}

/* Mobile full-screen takeover */
@media (max-width: 768px) {
  .cs-widget-root {
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: var(--z-widget);
  }
  .cs-widget-root .cs-widget {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .cs-widget--with-sidebar { width: 100vw; }
  .cs-mobile-only { display: flex; }
  #csSidebarToggleDesktop { display: none !important; }
  /* Sidebar as overlay drawer on mobile */
  .cs-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 2;
    width: 80vw;
    max-width: 240px;
    transform: translateX(-100%);
    transition: transform var(--motion-base) var(--ease-standard);
    box-shadow: var(--shadow-widget);
  }
  .cs-sidebar--open { transform: translateX(0); display: flex; }
  .cs-widget--with-sidebar .cs-widget { width: 100vw; }
  .cs-quick-replies { grid-template-columns: 1fr; }
  .cs-hs-contacts { flex-direction: column; gap: var(--space-1); }
}

/* RTL adjustments for Arabic */
[dir="rtl"] .cs-widget-root { right: auto; left: var(--offset-edge); }
[dir="rtl"] .cs-launcher { right: auto; left: var(--offset-edge); }
[dir="rtl"] .cs-msg-row--user { align-items: flex-start; }
[dir="rtl"] .cs-msg-row--ai { align-items: flex-end; }
[dir="rtl"] .cs-sidebar { border-right: none; border-left: 1px solid var(--border-soft); }
@media (max-width: 768px) {
  [dir="rtl"] .cs-sidebar { left: auto; right: 0; transform: translateX(100%); }
  [dir="rtl"] .cs-sidebar--open { transform: translateX(0); }
}
