:root {
    --primary: #2563EB;
    --primary-hover: #1d4ed8;
    --page: #f5f7fa;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --line-strong: #d1d5db;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --purple: #7c3aed;
    --disabled: #9ca3af;
    --sidebar: 224px;
    --radius: 10px;
    font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    color: var(--text);
    background: var(--page);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--page); }
body { font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar);
    display: flex; flex-direction: column; color: #dbeafe; background: #111827;
    transition: transform .2s ease, width .2s ease;
}
.sidebar-brand { height: 64px; display: flex; align-items: center; gap: 11px; padding: 0 18px; border-bottom: 1px solid #273244; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: #fff; background: var(--primary); font-size: 12px; font-weight: 800; }
.sidebar-brand div { min-width: 0; display: flex; flex-direction: column; }
.sidebar-brand strong { color: #fff; letter-spacing: .5px; }
.sidebar-brand small { color: #9ca3af; white-space: nowrap; }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px 24px; scrollbar-width: thin; }
.nav-group + .nav-group { margin-top: 5px; }
.nav-group h2 { margin: 0 10px 5px; color: #6b7280; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 33px; margin: 6px 0; padding: 3px 10px; border-radius: 7px; color: #cbd5e1; white-space: nowrap; }
.nav-item:hover { color: #fff; background: #1f2937; }
.nav-item.active { color: #fff; background: var(--primary); font-weight: 700; }
.nav-icon { display: grid; place-items: center; flex: 0 0 24px; height: 24px; border-radius: 6px; background: rgba(255,255,255,.08); font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 14px; font-weight: 400; }
.sidebar-meta { padding: 13px 18px; border-top: 1px solid #273244; display: flex; flex-direction: column; color: #9ca3af; font-size: 11px; }
.sidebar-meta strong { color: #d1d5db; }

.main-shell { min-height: 100vh; margin-left: var(--sidebar); transition: margin .2s ease; }
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; padding: 0 18px; display: flex; align-items: center; gap: 18px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(15,23,42,.03); }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 285px; }
.system-title { display: flex; align-items: baseline; gap: 9px; white-space: nowrap; }
.system-title strong { font-size: 15px; }
.system-title span { color: var(--muted); font-size: 12px; }
.icon-button { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); cursor: pointer; }
.icon-button:hover { color: var(--primary); border-color: #bfdbfe; background: #eff6ff; }
.global-search { flex: 1; max-width: 650px; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #f9fafb; }
.global-search span { color: var(--muted); font-size: 18px; }
.global-search input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size:12px; }
.global-search input:disabled { opacity: 1; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.mobile-menu-button { display: none; }
.top-link { display: flex; align-items: center; gap: 5px; height: 36px; padding: 0 9px; color: var(--muted); border-radius: 7px; }
.top-link:hover { color: var(--primary); background: #eff6ff; }
.top-link b { font-size: 12px; }
.notification-button i { position: absolute; top: -6px; right: -5px; min-width: 17px; padding: 1px 4px; color: #fff; background: var(--danger); border: 2px solid #fff; border-radius: 10px; font-size: 9px; font-style: normal; }
details { position: relative; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.quick-menu > div, .system-switch > div, .front-switch > div, .user-menu > div { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; min-width: 190px; padding: 7px; background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 12px 32px rgba(15,23,42,.14); }
.quick-menu a, .system-switch a, .front-switch a, .system-switch span, .user-menu a, .user-menu div > span, .user-menu form button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; white-space: nowrap; text-align: left; background: transparent; color: inherit; cursor: pointer; }
.quick-menu a:hover, .system-switch a:hover, .front-switch a:hover, .user-menu a:hover, .user-menu form button:hover { color: var(--primary); background: #eff6ff; }
.front-switch > div { max-height: min(70vh, 540px); overflow-y: auto; }
.nav-switch > .btn { min-width: 104px; font-weight: 650; }
.system-switch a.active { color: var(--primary); font-weight: 700; background: #eff6ff; }
.system-switch span, .user-menu div > span { color: var(--disabled); font-size: 12px; }
.user-menu summary { display: flex; align-items: center; gap: 7px; padding: 3px 5px; border-radius: 8px; }
.user-menu summary:hover { background: #f3f4f6; }
.user-menu summary b { font-size: 12px; }
.avatar { display: grid; place-items: center; width: 31px; height: 31px; color: #fff; background: var(--primary); border-radius: 50%; font-size: 12px; }

.content-shell { width: 100%; padding: 12px 18px 18px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.page-heading h1 { margin: 1px 0 3px; font-size: 24px; line-height: 1.25; }
.page-heading p { margin: 0; color: var(--muted); }
.breadcrumb { font-size: 12px; }
.page-actions { display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 13px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--text); background: #fff; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: #93c5fd; color: var(--primary); background: #eff6ff; }
.btn.primary { color: #fff; border-color: var(--primary); background: var(--primary); }
.btn.primary:hover:not(:disabled) { color: #fff; border-color: var(--primary-hover); background: var(--primary-hover); }
.btn.danger { color:#fff; border-color:#dc2626; background:#dc2626; }
.btn.danger:hover:not(:disabled) { color:#fff; border-color:#b91c1c; background:#b91c1c; }
.btn:disabled { color: var(--disabled); background: #f3f4f6; cursor: not-allowed; }
.module-tabs { display: flex; gap: 23px; width: 100%; margin-bottom: 16px; padding: 0 16px; overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); white-space: nowrap; scrollbar-width: thin; }
.module-tabs a { position: relative; display: flex; align-items: center; min-height: 48px; color: var(--muted); }
.module-tabs a:hover { color: var(--primary); }
.module-tabs a.active { color: var(--primary); font-weight: 700; }
.module-tabs a.active::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 15px; }
.metric-card { position: relative; min-height: 116px; padding: 17px 18px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15,23,42,.03); }
.metric-card::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 3px; background: var(--primary); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card strong { display: block; margin: 5px 0 1px; font-size: 28px; line-height: 1.2; }
.metric-card:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(15,23,42,.08); }
.metric-card.tone-green::before { background: var(--success); }
.metric-card.tone-amber::before { background: var(--warning); }
.metric-card.tone-purple::before { background: var(--purple); }
.metric-card.tone-red::before { background:#ef4444; }

.notice-box { margin-bottom: 15px; padding: 12px 15px; border: 1px solid #bfdbfe; border-left: 4px solid var(--primary); border-radius: 8px; color: #1e3a8a; background: #eff6ff; }
.notice-box strong, .notice-box p { margin: 0; }
.notice-box p { margin-top: 2px; }
.filter-bar { display: grid; grid-template-columns: minmax(260px, 2fr) minmax(130px, 1fr) minmax(130px, 1fr) auto; gap: 12px; margin-bottom: 15px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.filter-bar label, .block-label, .form-grid label { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--muted); font-size: 12px; }
.filter-bar input, .filter-bar select, .block-label input, .block-label select, .form-grid input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--text); background: #fff; outline: none; }
.filter-bar input:focus, .filter-bar select:focus, .block-label input:focus, .form-grid input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.filter-bar input:disabled, .filter-bar select:disabled { color: var(--disabled); background: #f9fafb; }
.filter-actions { display: flex; align-items: end; gap: 8px; }

/* Shared page workspace: title, view tabs, filters and actions in one compact row. */
.workspace-toolbar {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 68px; max-height: 80px;
    margin-bottom: 12px; padding: 7px 10px; overflow: hidden; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.workspace-toolbar .page-heading { flex: 0 0 auto; align-items: center; margin: 0; padding-right: 2px; }
.workspace-toolbar .page-heading h1 { margin: 0; font-size: 20px; line-height: 1.2; white-space: nowrap; }
.workspace-toolbar .breadcrumb { margin: 0 0 1px; font-size: 10px; line-height: 1.2; white-space: nowrap; }
.workspace-toolbar .page-description { display: none; }
.workspace-toolbar .module-tabs {
    flex: 0 1 auto; width: auto; min-width: 0; margin: 0; padding: 0 5px; gap: 16px;
    overflow-x: auto; border: 0; border-right: 1px solid var(--line); border-radius: 0;
    scrollbar-width: none;
}
.workspace-toolbar .module-tabs::-webkit-scrollbar, .workspace-filter::-webkit-scrollbar { display: none; }
.workspace-toolbar .module-tabs a { min-height: 34px; font-size: 13px; }
.workspace-toolbar .module-tabs a.active::after { height: 2px; }
.workspace-filter { flex: 1 1 420px; min-width: 160px; overflow-x: auto; scrollbar-width: none; }
.workspace-toolbar:has(.filter-multi[open]) { position:relative; z-index:60; overflow:visible; }
.workspace-filter:has(.filter-multi[open]) { overflow:visible; }
.workspace-filter .filter-bar {
    display: flex; align-items: center; width: 100%; min-width: max-content; gap: 7px;
    justify-content:flex-end; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent;
}
.workspace-filter .filter-bar label {
    display: block; flex: 0 0 112px; min-width: 0; color: transparent; font-size: 0; line-height: 1;
}
.workspace-filter .filter-bar label.filter-search { flex-basis: 250px; }
.workspace-filter .filter-bar label > span { display: none; }
.workspace-filter .filter-bar input, .workspace-filter .filter-bar select {
    height: 34px; padding: 0 9px; color: var(--text); font-size: 13px; line-height: normal;
}
.workspace-filter .customer-list-filter { justify-content:flex-end; }
.workspace-filter .customer-list-filter label.filter-search { flex-basis:220px; }
.workspace-filter .customer-list-filter label.filter-owner { flex-basis:130px; }
.workspace-filter .customer-list-filter label.filter-level { flex-basis:100px; }
.workspace-filter .customer-list-filter label.filter-country,
.workspace-filter .customer-list-filter label.filter-customer-type { flex-basis:120px; }
.workspace-filter .customer-list-filter .filter-multi { position:relative; flex:0 0 120px; min-width:0; }
.workspace-filter .customer-list-filter .filter-multi-trigger { box-sizing:border-box; display:flex; align-items:center; justify-content:space-between; width:100%; height:34px; padding:0 9px; border:1px solid var(--line-strong); border-radius:7px; background:#fff; color:var(--text); font-size:13px; text-align:left; white-space:nowrap; cursor:pointer; list-style:none; }
.workspace-filter .customer-list-filter .filter-multi-trigger::-webkit-details-marker { display:none; }
.workspace-filter .customer-list-filter .filter-multi-trigger::after { content:'▾'; margin-left:5px; font-size:11px; }
.workspace-filter .customer-list-filter .filter-multi[open] .filter-multi-trigger { border-color:var(--primary); }
.workspace-filter .customer-list-filter .filter-multi-trigger:focus-visible { border-color:var(--primary); outline:2px solid var(--primary); outline-offset:1px; }
.filter-multi-menu { position:absolute; top:calc(100% + 5px); right:0; z-index:80; width:min(290px,calc(100vw - 32px)); border:1px solid var(--line); border-radius:9px; background:#fff; box-shadow:0 12px 32px rgba(15,23,42,.14); }
.filter-multi-options { max-height:min(360px,55vh); overflow-y:auto; padding:6px; }
.workspace-filter .filter-bar .filter-multi-options label { box-sizing:border-box; display:flex; flex-direction:row; align-items:center; justify-content:flex-start; gap:10px; width:100%; min-height:34px; padding:5px 6px; color:var(--text); font-size:13px; line-height:1.3; text-align:left; white-space:normal; cursor:pointer; }
.workspace-filter .filter-bar .filter-multi-options label > span { display:inline; flex:1 1 auto; }
.workspace-filter .filter-bar .filter-multi-options input[type=checkbox] { flex:0 0 auto; width:16px; height:16px; padding:0; margin:0; }
.filter-multi-options label:hover { background:#eff6ff; }
.filter-multi-options p { padding:8px; color:var(--muted); }
.filter-multi-hint { margin:0; padding:8px 12px; border-top:1px solid var(--line); color:var(--muted); font-size:12px; }
.workspace-filter .filter-actions { flex: 0 0 auto; align-items: center; gap: 6px; }
.workspace-toolbar .btn { min-height: 34px; padding: 6px 11px; white-space: nowrap; }
.workspace-toolbar .page-actions { flex: 0 0 auto; gap: 6px; }
.workspace-toolbar.pool-import-toolbar { flex-wrap:nowrap; max-height:80px; overflow:visible; }
.pool-import-toolbar .workspace-filter { flex:1 1 0; min-width:0; order:0; overflow-x:auto; }
.pool-import-toolbar .workspace-filter .filter-bar { justify-content:flex-end; }
.pool-heading-import { display:flex; align-items:center; gap:0; flex:0 0 auto; border-left:1px solid var(--line); padding-left:7px; }
.pool-heading-import .pool-import-menu { position:relative; }
.pool-import-link { display:inline-flex; align-items:center; min-height:34px; padding:5px 9px; border:0; border-radius:5px; background:transparent; color:var(--muted); font-size:13px; line-height:1.3; white-space:nowrap; text-decoration:none; cursor:pointer; }
.pool-import-link:hover, .pool-import-link:focus-visible, .pool-import-menu[open] > .pool-import-link { color:var(--primary); background:#eff5ff; }
.pool-import-menu > .pool-import-link { list-style:none; }
.pool-import-menu > .pool-import-link::-webkit-details-marker { display:none; }
.workspace-filter .pool-list-filter { gap:5px; }
.workspace-filter .pool-list-filter label.filter-search { flex-basis:160px; }
.workspace-filter .pool-list-filter label.filter-owner { flex-basis:105px; }
.workspace-filter .pool-list-filter label.filter-level { flex-basis:82px; }
.workspace-filter .pool-list-filter .filter-multi.filter-country { flex-basis:90px; }
.workspace-filter .pool-list-filter .filter-multi.filter-customer-type { flex-basis:98px; }
.workspace-filter .pool-list-filter label.filter-contact { flex-basis:108px; }

.table-card, .panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15,23,42,.03); }
.table-toolbar { min-height: 51px; padding: 8px 13px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); color: var(--muted); }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 850px; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: #4b5563; background: #f9fafb; font-size: 12px; font-weight: 700; }
td { color: #374151; }
.table-card table, .table-card th, .table-card td, .table-card a, .table-card button, .table-card small { font-size: 12px; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--text); font-size: 16px; }
.empty-state p { margin: 5px 0 0; }
.pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-height: 53px; padding: 8px 13px; color: var(--muted); }
.page-size { display: flex; align-items: center; gap: 5px; }
.page-size select { height: 32px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.page-button { display:inline-flex; align-items:center; justify-content:center; height:32px; padding:0 10px; border:1px solid var(--line); border-radius:6px; color:var(--text); background:#fff; text-decoration:none; cursor:pointer; }
.page-button:hover:not(:disabled) { border-color:var(--primary); color:var(--primary); }
.page-button:disabled { color:var(--muted); background:#f8fafc; cursor:not-allowed; opacity:.65; }
.page-numbers { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:3px; }
.page-number { display:grid; place-items:center; min-width:29px; height:32px; padding:0 3px; border:1px solid var(--line); border-radius:6px; color:var(--text); background:#fff; text-decoration:none; }
.page-number:hover { border-color:var(--primary); color:var(--primary); }
.pagination strong { display: grid; place-items: center; width: 32px; height: 32px; color: #fff; background: var(--primary); border-radius: 6px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 15px; }
.span-8 { grid-column: span 8; }
.span-4 { grid-column: span 4; }
.panel { padding: 16px; }
.panel > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel h2 { margin: 0; font-size: 16px; }
.panel header span { color: var(--muted); font-size: 12px; }
.readiness-list > div { min-height: 42px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.readiness-list > div:last-child { border-bottom: 0; }
.badge { padding: 3px 8px; border-radius: 10px; font-size: 11px; }
.badge.success { color: #166534; background: #dcfce7; }
.badge.neutral { color: #4b5563; background: #f3f4f6; }
.definition-list { margin: 0; }
.definition-list div { display: grid; grid-template-columns: 95px 1fr; padding: 8px 0; border-bottom: 1px solid var(--line); }
.definition-list div:last-child { border-bottom: 0; }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; font-weight: 600; }

.alert { margin-bottom: 15px; padding: 12px 15px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.alert.success { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.alert.error { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.alert.warning { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.alert ul { margin: 7px 0 0; padding-left: 20px; }

.installer-body { padding: 35px 18px; background: var(--page); }
.installer-shell { width: min(920px, 100%); margin: 0 auto; }
.installer-header { margin-bottom: 18px; }
.installer-header span { color: var(--primary); font-weight: 800; }
.installer-header h1 { margin: 5px 0 1px; font-size: 28px; }
.installer-header p { margin: 0; color: var(--muted); }
.installer-card { margin-bottom: 15px; padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 18px rgba(15,23,42,.05); }
.installer-card h2 { margin: 0 0 13px; font-size: 17px; }
.installer-card h2:not(:first-child) { margin-top: 22px; }
.check-list { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.check-row { display: grid; grid-template-columns: 16px minmax(180px, 1fr) minmax(100px, 1fr); align-items: center; gap: 9px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row small { grid-column: 2 / -1; color: var(--danger); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--disabled); }
.status-dot.success { background: var(--success); }
.status-dot.error { background: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid h2, .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; }
.block-label { max-width: 450px; margin-bottom: 14px; }
.maintenance-key { display: block; padding: 14px; overflow-wrap: anywhere; color: #1e3a8a; background: #eff6ff; border: 1px dashed #93c5fd; border-radius: 8px; font-size: 16px; }

.auth-body { min-height: 100vh; padding: 40px 16px; display: grid; place-items: center; background: linear-gradient(145deg, #eff6ff, #f8fafc 55%, #eef2ff); }
.auth-shell { width: min(460px, 100%); }
.auth-card { padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 55px rgba(15,23,42,.12); }
.auth-card h1 { margin: 18px 0 5px; font-size: 24px; }
.auth-card .block-label { max-width: none; margin: 14px 0; }
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; color: #fff; background: var(--primary); font-weight: 800; }
.auth-brand div { display: flex; flex-direction: column; }
.auth-brand small, .muted { color: var(--muted); }
.remember-row { display: flex; align-items: center; gap: 7px; margin: 12px 0 16px; color: var(--muted); }
.auth-submit { width: 100%; min-height: 42px; }
.btn.danger { color: #fff; border-color: var(--danger); background: var(--danger); }
.auth-systems { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.auth-systems a, .auth-systems span { padding: 6px 9px; border-radius: 6px; background: #f3f4f6; color: var(--muted); font-size: 12px; }
.auth-systems a:hover { color: var(--primary); background: #eff6ff; }

.permission-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.permission-table select { min-width: 130px; height: 34px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; }
.permission-table .role-list { min-width: 180px; white-space: normal; }
.staff-account-table { width:100%; min-width:1450px; table-layout:fixed; }
.staff-account-table th,.staff-account-table td { padding:8px 6px; vertical-align:middle; overflow-wrap:anywhere; }
.staff-account-table select { width:100%; min-width:0; max-width:100%; }
.staff-account-table th:not(:last-child),.staff-account-table td:not(:last-child) { text-align:center; }
.staff-sort-cell input { width:100%; min-width:48px; height:32px; padding:4px; text-align:center; }
.staff-avatar { width:32px; height:32px; margin:auto; display:grid; place-items:center; overflow:hidden; border:1px solid #d8e5f5; border-radius:50%; background:#eef5ff; color:var(--primary); font-weight:700; }
.staff-avatar img { width:100%; height:100%; display:block; object-fit:cover; }
.staff-avatar>span{display:grid;position:absolute;z-index:0;inset:0;place-items:center}.staff-avatar>img{position:relative;z-index:1}.staff-avatar{position:relative}
.staff-status { display:inline-flex; padding:3px 8px; border-radius:999px; font-size:12px; font-weight:700; }
.staff-status.active { color:#16833e; background:#e9f9ef; }
.staff-status.inactive { color:#a13a3a; background:#fff0f0; }
.staff-account-table th:nth-child(8),.staff-account-table td:nth-child(8) { white-space:nowrap; }
.staff-account-table td:nth-child(8) small { display:inline; margin-left:5px; color:var(--muted); white-space:nowrap; }
.staff-role-cell { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.staff-permission-actions { min-width:0; }
.staff-permission-summary { display:grid; grid-template-columns:minmax(180px,1.3fr) minmax(130px,.8fr) minmax(110px,.7fr); align-items:center; gap:7px; margin-bottom:7px; }
.staff-permission-item { display:flex; align-items:center; gap:7px; min-width:0; min-height:34px; padding:5px 8px; overflow:hidden; background:#f8fafc; border:1px solid var(--line); border-radius:7px; white-space:nowrap; }
.staff-permission-item > b { flex:0 0 auto; color:var(--muted); font-size:11px; }
.staff-permission-item > span { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.staff-role-chip { display:inline-flex; align-items:center; gap:3px; margin-right:6px; padding:2px 6px; border-radius:6px; background:#eef5ff; color:var(--primary); }
.staff-role-chip .inline-remove-form { display:inline-flex; }
.staff-permission-actions details { display:block; }
.staff-role-editor > summary { width:max-content; min-height:30px; padding:4px 9px; font-size:12px; }
.staff-permission-actions .inline-admin-form { display:flex; align-items:end; gap:7px; flex-wrap:nowrap; width:100%; margin-top:7px; padding:9px; border:1px solid #bfdbfe; border-radius:8px; background:#eff6ff; }
.staff-permission-actions .inline-admin-form label { display:grid; flex:0 0 125px; gap:4px; min-width:0; font-size:11px; }
.staff-permission-actions .inline-admin-form label:nth-of-type(2) { flex-basis:145px; }
.staff-permission-actions .inline-admin-form label:nth-of-type(3) { flex-basis:120px; }
.staff-permission-actions .inline-admin-form label:nth-of-type(4) { flex:1 1 150px; }
.staff-permission-actions .inline-admin-form select,.staff-permission-actions .inline-admin-form input { width:100%; min-width:0; height:32px; }
.staff-permission-actions .inline-admin-form .btn { flex:0 0 auto; min-height:32px; padding:5px 12px; }
.inline-remove-form { display: inline; margin-left: 4px; }
.inline-remove-form button { border: 0; background: transparent; color: #DC2626; cursor: pointer; font-size: 16px; line-height: 1; }
.permission-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.permission-group { padding: 13px; border: 1px solid var(--line); border-radius: 8px; }
.permission-group h3 { margin: 0 0 8px; font-size: 14px; }
.permission-option { display: flex; align-items: flex-start; gap: 7px; padding: 5px 0; color: #374151; }
.permission-option small { display: block; color: var(--muted); }
.sensitive-mark { color: var(--danger); font-weight: 700; }
.scope-summary { padding: 10px 12px; color: #1e3a8a; background: #eff6ff; border-radius: 7px; }

/* DEV3 customer/contact pages */
.form-panel { padding: 18px; }
.form-panel > header, .detail-list > header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.form-panel textarea { width:100%; min-height:82px; padding:9px 10px; border:1px solid var(--line-strong); border-radius:7px; resize:vertical; outline:0; }
.form-panel select { width:100%; height:38px; padding:0 10px; border:1px solid var(--line-strong); border-radius:7px; background:#fff; }
.form-grid label { color:var(--muted); font-size:12px; }.form-grid .wide { grid-column:1 / -1; }

/* Compact task and business-file create forms */
.task-create-panel,.file-upload-panel { padding:0; overflow:hidden; }
.task-create-panel > header,.file-upload-panel > header { min-height:62px; margin:0; padding:12px 16px; border-bottom:1px solid var(--line); }
.task-create-panel > header h2,.file-upload-panel > header h2 { margin:0 0 3px; font-size:17px; }
.task-create-panel > header p,.file-upload-panel > header p { margin:0; color:var(--muted); font-size:12px; }
.compact-task-form { padding:14px 16px 0; }
.task-form-row { display:grid; align-items:end; gap:12px; margin-bottom:10px; }
.task-form-core { grid-template-columns:minmax(0,31fr) minmax(0,15fr) minmax(0,14fr); }
.task-form-relation { grid-template-columns:minmax(0,15fr) minmax(0,25fr) minmax(0,20fr); }
.task-form-assignment { grid-template-columns:minmax(0,12fr) minmax(0,25fr) minmax(0,11fr) minmax(0,12fr); }
.task-form-schedule { grid-template-columns:repeat(3,minmax(0,1fr)); }
.task-form-row > label,.compact-task-form > label { display:flex; flex-direction:column; gap:4px; min-width:0; color:var(--muted); font-size:12px; }
.compact-task-form input,.compact-task-form select { width:100%; height:36px; min-height:36px; padding:0 10px; border:1px solid var(--line-strong); border-radius:7px; color:var(--text); background:#fff; font-size:12px; outline:0; }
.compact-task-form input:focus,.compact-task-form select:focus,.compact-task-form textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(37,99,235,.1); }
.compact-task-form input:disabled,.compact-task-form select:disabled { color:var(--muted); background:#f9fafb; opacity:1; }
.compact-task-form textarea { width:100%; min-height:70px; padding:9px 10px; border:1px solid var(--line-strong); border-radius:7px; font-size:12px; resize:vertical; outline:0; }
.task-description-field { margin-bottom:10px; }
.compact-file-form .compact-form-footer { grid-column:1 / -1; }
.compact-form-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:49px; margin:0 -16px; padding:8px 16px; border-top:1px solid var(--line); background:#fafbfd; color:var(--muted); font-size:12px; }
.compact-form-footer > div { display:flex; align-items:center; gap:8px; }
.compact-file-form { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; padding:14px 16px 0; }
.compact-file-form > label:not(.compact-upload-zone) { display:flex; flex-direction:column; gap:4px; min-width:0; color:var(--muted); font-size:12px; }
.compact-file-form input:not([type="file"]),.compact-file-form select { width:100%; height:38px; min-height:38px; padding:0 10px; border:1px solid var(--line-strong); border-radius:7px; color:var(--text); background:#fff; font-size:12px; outline:0; }
.compact-file-form input:focus,.compact-file-form select:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(37,99,235,.1); }
.compact-file-form input:disabled { color:var(--muted); background:#f9fafb; opacity:1; }
.compact-upload-zone { grid-column:1 / -1; min-height:105px; display:flex; align-items:center; justify-content:center; gap:14px; padding:18px; border:1px dashed #8eaddb; border-radius:8px; color:var(--text); background:#f7faff; cursor:pointer; }
.compact-upload-zone:hover,.compact-upload-zone.is-dragover { border-color:var(--primary); background:#eef5ff; }
.compact-upload-zone input[type="file"] { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; }
.upload-zone-icon { display:grid; place-items:center; flex:0 0 48px; width:48px; height:48px; border-radius:50%; color:var(--primary); background:#eaf2ff; font-size:25px; }
.compact-upload-zone strong { font-size:14px; }
.compact-upload-zone small { color:var(--muted); font-size:12px; }
.compact-upload-zone em { margin-left:18px; font-style:normal; pointer-events:none; }
.pending-file-section { grid-column:1 / -1; min-width:0; }
.pending-file-section > header { display:flex; align-items:center; justify-content:space-between; min-height:34px; margin:0; }
.pending-file-section h3 { margin:0; font-size:17px; }
.pending-file-section header span { color:var(--muted); font-size:12px; }
.pending-file-table { overflow:hidden; border:1px solid var(--line); border-radius:7px; }
.pending-file-row { display:grid; grid-template-columns:minmax(0,1fr) 90px 110px; align-items:center; gap:12px; min-height:46px; padding:7px 14px; border-bottom:1px solid var(--line); font-size:12px; }
.pending-file-row:last-child { border-bottom:0; }
.pending-file-row strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pending-file-row span:first-of-type { justify-self:start; padding:2px 7px; border-radius:5px; color:var(--primary); background:#edf4ff; }
.pending-file-empty { min-height:62px; display:grid; place-items:center; padding:12px; color:var(--muted); font-size:12px; background:#fff; }
.compact-file-form .compact-form-footer { grid-column:1 / -1; }
.check-label { flex-direction:row!important; align-items:center; gap:7px!important; color:var(--text)!important; }
.detail-list { margin-top:15px; padding:16px; }.contact-item { display:flex; justify-content:space-between; gap:16px; padding:12px 0; border-bottom:1px solid var(--line); }.contact-item:last-child { border-bottom:0; }
.contact-item strong,.contact-item small,.contact-item p { display:block; }.contact-item small,.contact-item p { margin:3px 0 0; color:var(--muted); font-size:12px; }.inline-actions { display:flex; align-items:flex-start; gap:6px; white-space:nowrap; }.inline-actions form { margin:0; }
.sub-tabs { display:flex; gap:8px; margin-bottom:15px; overflow-x:auto; white-space:nowrap; }.sub-tabs a { padding:7px 10px; border:1px solid var(--line); border-radius:7px; color:var(--muted); background:#fff; }.sub-tabs a.active { color:#fff; border-color:var(--primary); background:var(--primary); }
.badge.primary { color:#1d4ed8; background:#dbeafe; }.badge.a { color:#991b1b;background:#fee2e2; }.badge.b { color:#92400e;background:#fef3c7; }.badge.c { color:#1d4ed8;background:#dbeafe; }
td small { display:block; margin-top:2px; color:var(--muted); font-size:11px; }.record-link,.text-action { color:var(--primary); font-weight:600; }.contact-fold { margin-top:4px; color:var(--primary); font-size:11px; }.contact-fold > div { max-width:260px; padding:5px; color:var(--muted); white-space:normal; }
.customer-summary-card button.text-action { padding:0; border:0; background:transparent; font:inherit; color:var(--primary); font-size:12px; font-weight:700; cursor:pointer; }
.customer-list-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:53px; padding:7px 13px; border-top:1px solid var(--line); }
.customer-list-footer .pagination { min-height:0; margin-left:auto; padding:0; }
.customer-bulk-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.customer-bulk-toolbar select { height:34px; min-width:130px; padding:0 9px; border:1px solid var(--line-strong); border-radius:7px; color:var(--text); background:#fff; font-size:12px; }
.customer-row-select { width:15px; height:15px; }

/* Customer list, customer overview and communication history */
.customer-list-card { width:100%; }
.customer-list-card .table-scroll { width:100%; max-width:100%; overflow-x:hidden; }
.kh-customer-table { width:100%; max-width:100%; min-width:0; table-layout:fixed; }
.kh-customer-table th,.kh-customer-table td { box-sizing:border-box; max-width:0; overflow:hidden; padding:5px 5px; border-right:1px solid var(--line); text-overflow:ellipsis; white-space:nowrap; }
.kh-customer-table th:first-child,.kh-customer-table td:first-child { padding-right:2px; padding-left:2px; text-align:center; }
.kh-customer-table th:last-child,.kh-customer-table td:last-child { border-right:0; }
.contact-list-card .table-scroll { width:100%; max-width:100%; overflow-x:hidden; }
.contact-list-table { width:100%; max-width:100%; min-width:0; table-layout:fixed; }
.contact-list-table th,.contact-list-table td { box-sizing:border-box; max-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pool-list-card { width:100%; }
.pool-list-card .table-scroll { width:100%; max-width:100%; overflow-x:hidden; }
.pool-customer-table { width:100%; max-width:100%; min-width:0; table-layout:fixed; }
.pool-customer-table th,.pool-customer-table td { box-sizing:border-box; max-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pool-customer-table th:first-child,.pool-customer-table td:first-child { padding-right:2px; padding-left:2px; text-align:center; }
.pool-customer-table :is(th,td):is(:nth-child(2),:nth-child(3),:nth-child(4),:nth-child(6),:nth-child(12)) { text-align:center; }
.pool-customer-table th:last-child,.pool-customer-table td:last-child { border-right:0; }
.my-imported-pool-table .pool-row-actions { display:flex; align-items:center; gap:6px; min-width:0; white-space:nowrap; }
.my-imported-pool-table .pool-row-actions .text-action { display:inline-flex; align-items:center; padding:0; border:0; background:none; color:var(--primary); font-size:12px; font-weight:600; line-height:1.35; text-decoration:none; cursor:pointer; }
.my-imported-pool-table .pool-claim-form { display:inline-flex; margin:0; }
.lead-list-card { width:100%; overflow:hidden; }
.lead-list-card .table-scroll { width:100%; }
.lead-list-table { width:100%; min-width:1380px; max-width:none; table-layout:fixed; }
.followup-list-table table { min-width:1420px; }
.inquiry-list-table table { min-width:1380px; }
.contact-list-table th,.contact-list-table td,
.pool-customer-table th,.pool-customer-table td,
.lead-list-table th,.lead-list-table td,
.followup-list-table th,.followup-list-table td,
.inquiry-list-table th,.inquiry-list-table td { padding:5px; vertical-align:middle; }
.lead-list-table th,.lead-list-table td { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lead-list-table td a { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lead-list-table th:last-child,.lead-list-table td:last-child { overflow:visible; }
.lead-list-table td:last-child .inline-actions { align-items:center; gap:8px; }
.lead-list-table td:last-child .text-action { display:inline-flex; width:auto; padding:0; border:0; color:var(--primary); background:transparent; font-size:12px; font-weight:600; cursor:pointer; }
.contact-social-links { display:flex; align-items:center; flex-wrap:wrap; gap:5px; }
.contact-list-identity { display:flex; align-items:center; gap:6px; min-width:0; white-space:nowrap; }
.contact-list-identity .record-link { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.contact-list-identity .badge { flex:0 0 auto; }
.contact-remark-cell { display:block; width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.contact-inline-remarks { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.contact-inline-remarks > span { display:block; width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.contact-inline-remarks[data-editable="1"] { cursor:text; }
.contact-inline-remarks[data-editable="1"]:hover { background:#eff6ff; }
.contact-inline-remarks input { box-sizing:border-box; width:100%; max-width:100%; height:30px; min-width:0; padding:4px 6px; border:1px solid var(--primary); border-radius:5px; background:#fff; color:var(--text); font:inherit; font-size:12px; outline:none; }
.contact-list-table .contact-list-identity,.contact-list-table .contact-social-links { max-width:100%; overflow:hidden; flex-wrap:nowrap; }
.file-list-card .table-scroll { width:100%; max-width:100%; overflow-x:hidden; }
.file-bulk-toolbar { display:flex; align-items:center; gap:8px; min-height:48px; margin-bottom:10px; padding:7px 12px; border:1px solid var(--line); border-radius:var(--radius); background:#fff; }
.file-bulk-toolbar > span { margin-right:auto; color:var(--muted); }
.file-row-select,.file-select-all,.pool-customer-row-select { width:15px; height:15px; }
.file-list-table { width:100%; max-width:100%; min-width:0; table-layout:fixed; }
.file-list-table th,.file-list-table td { box-sizing:border-box; max-width:0; overflow:hidden; padding:5px; text-overflow:ellipsis; white-space:nowrap; }
.file-list-table th:first-child,.file-list-table td:first-child { padding-right:2px; padding-left:2px; text-align:center; }
.file-list-identity { display:flex; align-items:center; gap:8px; min-width:0; max-width:100%; overflow:hidden; }
.file-list-thumb,.file-list-placeholder { flex:0 0 38px; width:38px; height:38px; border:1px solid var(--line); border-radius:6px; background:#f8fafc; }
.file-list-thumb { display:block; object-fit:cover; }
.file-list-placeholder { display:grid; place-items:center; overflow:hidden; padding:2px; color:var(--primary); font-size:9px; font-weight:800; }
.file-list-name { display:block; min-width:0; overflow:hidden; }
.file-list-name strong,.file-list-name small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file-list-actions { display:flex; align-items:center; gap:8px; min-width:0; white-space:nowrap; }
.file-list-actions .inline-form { margin:0; }
.customer-inline-text,.customer-inline-field { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.customer-inline-text > span,.customer-inline-field > span { display:block; width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.customer-inline-text[data-editable="1"],.customer-inline-field[data-editable="1"] { cursor:text; }
.customer-inline-text[data-editable="1"]:hover,.customer-inline-field[data-editable="1"]:hover { background:#eff6ff; }
.customer-inline-text input,.customer-inline-field input,.customer-inline-field select { box-sizing:border-box; width:100%; max-width:100%; height:30px; min-width:0; padding:4px 6px; border:1px solid var(--primary); border-radius:5px; background:#fff; color:var(--text); font:inherit; font-size:12px; outline:none; }
.social-icon { display:inline-grid; place-items:center; width:24px; height:24px; border:1px solid #bfdbfe; border-radius:6px; color:#2563eb; background:#eff6ff; font-size:11px; font-weight:800; text-decoration:none; }
.social-icon:hover { color:#fff; background:#2563eb; border-color:#2563eb; }
.cell-ellipsis { display:block; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cell-ellipsis .record-link { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.customer-detail-columns { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; align-items:start; }
.customer-detail-columns > div { display:grid; gap:14px; min-width:0; }
.customer-summary-card { min-height:150px; padding:16px; background:#fff; border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 1px 2px rgba(15,23,42,.03); }
.customer-summary-card header { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.customer-summary-card h3 { margin:0; font-size:16px; }
.customer-summary-card header a { color:var(--primary); font-size:12px; font-weight:700; }
.customer-summary-card .summary-count { display:inline-block; margin:14px 7px 0 0; color:var(--primary); font-size:30px; line-height:1; }
.customer-summary-card > span { color:var(--muted); }
.profile-card { min-height:0; }
.profile-card .definition-list dd { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.summary-row { display:flex; justify-content:space-between; gap:10px; padding:9px 0; border-bottom:1px solid var(--line); }
.summary-row:last-child { border-bottom:0; }
.summary-row b { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.summary-row span { flex:0 1 auto; color:var(--muted); font-size:11px; text-align:right; }
.contact-detail > header { align-items:flex-start; }
.contact-detail h2 { margin-top:4px; }
.contact-definition { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 28px; }
.communication-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:14px; }
.communication-panel { min-width:0; }
.communication-panel > header { align-items:flex-start; gap:10px; }
.communication-panel > header h2 { margin-bottom:3px; }
.communication-import > div,.communication-import > form { position:absolute; top:calc(100% + 7px); right:0; z-index:12; width:min(460px,80vw); padding:10px; background:#fff; border:1px solid var(--line); border-radius:8px; box-shadow:0 12px 30px rgba(15,23,42,.15); }
.communication-import form { display:grid; grid-template-columns:1fr; gap:8px; }
.communication-import input,.communication-import select { width:100%; min-height:36px; padding:6px 8px; border:1px solid var(--line-strong); border-radius:6px; background:#fff; }
.conversation-box { height:360px; padding:14px; overflow-y:auto; background:#f3f6f9; border:1px solid var(--line); border-radius:9px; }
.message-bubble { width:fit-content; max-width:82%; margin:0 0 11px; padding:9px 11px; background:#fff; border:1px solid var(--line); border-radius:4px 11px 11px; box-shadow:0 1px 2px rgba(15,23,42,.04); }
.message-bubble.outbound { margin-left:auto; background:#dcfce7; border-color:#bbf7d0; border-radius:11px 4px 11px 11px; }
.message-bubble small,.message-bubble strong { display:block; margin-bottom:4px; }
.message-bubble small { color:var(--muted); font-size:10px; }
.message-bubble p { margin:0; overflow-wrap:anywhere; }
.message-compose { display:grid; grid-template-columns:90px minmax(100px,.7fr) 180px minmax(160px,1fr) auto; gap:8px; margin-top:10px; }
.message-compose input,.message-compose select,.message-compose textarea { min-width:0; min-height:38px; padding:8px 9px; border:1px solid var(--line-strong); border-radius:7px; background:#fff; }
.message-compose textarea { grid-column:1 / -2; min-height:68px; resize:vertical; }
.message-compose button { grid-column:-2; }

/* Customer detail layout based on the approved KH sketch */
.customer-detail-hero { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:14px; padding:18px 22px; background:#fff; border:1px solid #bfdbfe; border-left:4px solid var(--primary); border-radius:var(--radius); box-shadow:0 1px 2px rgba(15,23,42,.03); }
.customer-detail-hero span { display:block; margin-bottom:3px; color:var(--primary); font-size:11px; font-weight:800; letter-spacing:1px; }
.customer-detail-hero h1 { margin:0; font-size:23px; line-height:1.25; }
.customer-detail-hero p { margin:5px 0 0; color:var(--muted); }
.customer-detail-workspace { display:grid; grid-template-columns:minmax(360px,40%) minmax(0,60%); gap:14px; align-items:start; font-size:12px; }
.customer-profile-column,.customer-communication-column { min-width:0; padding:16px; background:#fff; border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 1px 2px rgba(15,23,42,.03); }
.customer-profile-column { display:grid; gap:12px; }
.customer-profile-column > h2 { margin:0 0 2px; font-size:18px; }
.customer-profile-column .customer-summary-card { min-height:0; box-shadow:none; }
.customer-profile-column .profile-card { background:#f8fafc; }
.customer-profile-column .profile-card > header { margin-bottom:4px; }
.customer-profile-column .definition-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 18px; }
.customer-profile-column .definition-list div { grid-template-columns:78px minmax(0,1fr); }
.customer-profile-column .definition-list .customer-profile-wide { grid-column:1 / -1; }
.customer-profile-column .definition-list .customer-profile-time { grid-column:auto; }
.customer-profile-column .definition-list .customer-profile-wide dd { overflow:visible; text-overflow:clip; white-space:normal; overflow-wrap:anywhere; }
.customer-module-tiles { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.customer-nav-tile { position:relative; min-height:68px; background:#fff; border:1px solid var(--line-strong); border-radius:9px; transition:border-color .16s ease,background .16s ease,transform .16s ease; }
.customer-nav-tile:hover { color:var(--primary); background:#eff6ff; border-color:#93c5fd; transform:translateY(-1px); }
.customer-nav-main { display:flex; align-items:center; min-height:68px; padding:14px 52px 14px 16px; color:inherit; }
.customer-nav-main span { font-size:15px; font-weight:800; }
.customer-nav-main strong { position:absolute; right:12px; bottom:7px; display:grid; place-items:center; min-width:25px; height:25px; padding:0 7px; color:var(--primary); background:#eff6ff; border-radius:15px; }
.customer-nav-add { position:absolute; top:5px; right:10px; z-index:2; display:grid; width:25px; height:25px; place-items:center; color:var(--primary); border-radius:6px; font-size:19px; font-weight:800; }
.customer-nav-add:hover { color:#fff; background:var(--primary); }
.customer-nav-add::after { content:attr(aria-label); position:absolute; right:-1px; bottom:calc(100% + 7px); display:none; padding:5px 8px; color:#fff; background:#0f172a; border-radius:5px; box-shadow:0 5px 14px rgba(15,23,42,.2); font-size:11px; font-weight:500; white-space:nowrap; }
.customer-nav-add:hover::after { display:block; }
.customer-communication-column { padding:0; }
.customer-communication-workspace { min-height:720px; margin:0; padding:18px; border:0; box-shadow:none; }
.customer-communication-workspace > header { align-items:flex-start; margin-bottom:14px; }
.customer-communication-workspace > header span { color:var(--primary); font-size:11px; font-weight:800; letter-spacing:1px; }
.customer-communication-workspace > header h2 { margin:0; font-size:20px; }
.customer-communication-workspace > header > strong { color:var(--muted); font-size:12px; }
.communication-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-bottom:14px; }
.communication-tabs a { display:grid; place-items:center; min-height:40px; padding:5px; color:#475569; background:#fff; border:1px solid var(--line-strong); border-radius:9px; font-size:15px; font-weight:800; text-align:center; }
.communication-tabs a:hover,.communication-tabs a.active { color:#1d4ed8; background:#eff6ff; border-color:#60a5fa; box-shadow:inset 0 0 0 1px #60a5fa; }
.communication-channel-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.communication-channel-toolbar h3 { margin:0; font-size:15px; }
.communication-channel-toolbar span { display:block; margin-top:2px; color:var(--muted); font-size:11px; }
.customer-conversation-box { height:800px; }
.customer-message-compose { padding-top:2px; border-top:0; }

/* Bilingual communication records and translation CSV workflow */
.translation-toolbar { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:12px; }
.translation-filters,.translation-actions { display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.translation-filters select,.translation-filters input { min-height:36px; padding:6px 8px; border:1px solid var(--line-strong); border-radius:7px; background:#fff; font-size:12px; }
.translation-actions { justify-content:flex-end; }
.translation-actions .communication-import { position:relative; }
.translation-actions .communication-import > form { right:0; left:auto; }
.translation-actions label { display:flex; align-items:center; gap:6px; min-height:30px; }
.translation-actions label input { width:auto; min-height:0; }
.translation-preview { margin:0 0 12px; padding:12px; border:1px solid #93c5fd; border-radius:9px; background:#eff6ff; }
.translation-preview > header,.translation-preview-actions { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.translation-preview > header span { color:var(--muted); font-size:11px; }
.translation-preview > header div span { display:block; margin-top:3px; }
.translation-preview-stats { display:grid; grid-template-columns:repeat(5,minmax(70px,1fr)); gap:8px; margin:10px 0; }
.translation-preview-stats span { padding:8px; text-align:center; background:#fff; border:1px solid #bfdbfe; border-radius:7px; }
.translation-preview-stats .danger { color:#b91c1c; border-color:#fecaca; }
.translation-preview-actions form { display:flex; align-items:center; gap:10px; }
.overwrite-confirm { color:#b91c1c; font-weight:700; }
.bilingual-conversation { display:block; padding:12px; }
.bilingual-conversation .bilingual-message-card + .bilingual-message-card { margin-top:12px; }
.bilingual-message-card { min-width:0; overflow:hidden; background:#fff; border:1px solid var(--line); border-radius:10px; box-shadow:0 1px 2px rgba(15,23,42,.05); }
.bilingual-message-card > header { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 11px; border-bottom:1px solid var(--line); background:#f8fafc; }
.bilingual-message-card > header span { min-width:0; overflow:hidden; color:var(--muted); font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.translation-status { flex:none; padding:3px 7px; color:#64748b; background:#e2e8f0; border-radius:12px; font-size:10px; font-style:normal; font-weight:700; }
.translation-status.translated,.translation-status.imported,.translation-status.reviewed { color:#166534; background:#dcfce7; }
.translation-status.needs_retranslation { color:#9a3412; background:#ffedd5; }
.translation-status.failed { color:#b91c1c; background:#fee2e2; }
.bilingual-columns { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:stretch; }
.bilingual-columns > section { min-width:0; padding:12px; }
.bilingual-columns > section + section { border-left:1px solid var(--line); background:#f8fbff; }
.bilingual-columns b { display:block; margin-bottom:7px; color:#64748b; font-size:11px; }
.bilingual-columns h4 { margin:0 0 8px; font-size:13px; overflow-wrap:anywhere; }
.bilingual-columns p { margin:0; line-height:1.65; overflow-wrap:anywhere; white-space:normal; }
.translation-placeholder { color:#94a3b8; font-style:italic; }
.communication-pagination { display:flex; align-items:center; justify-content:flex-end; gap:8px; margin-top:10px; }
.communication-pagination span { color:var(--muted); }

@media (max-width:900px) {
  .translation-toolbar { display:grid; }
  .translation-actions { justify-content:flex-start; }
  .translation-preview-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .translation-preview-actions,.translation-preview-actions form { align-items:stretch; flex-direction:column; }
  .bilingual-columns { grid-template-columns:1fr; }
  .bilingual-columns > section + section { border-top:1px solid var(--line); border-left:0; }
}

/* Compact customer create/edit form: 5 + 5 + 4 fields, then full-width rows. */
.customer-form-panel { padding:14px 16px; }
.customer-form-panel > header { margin-bottom:10px; padding-bottom:9px; border-bottom:1px solid var(--line); }
.customer-form-panel > header h2 { margin:0; font-size:20px; }
.customer-compact-form { grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px 12px; }
.customer-compact-form label { gap:4px; }
.customer-compact-form input,.customer-compact-form select { height:36px; }
.customer-compact-form .wide { grid-column:1 / -1; }
.customer-compact-form .customer-advice-field textarea { min-height:84px; }
.customer-compact-form .customer-remarks-field textarea { min-height:112px; }
.customer-form-actions { gap:8px; padding-top:2px; }

/* Compact contact create/edit form: three rows of five fields. */
.contact-form-panel { padding:14px 16px; }
.contact-form-panel > header { margin-bottom:10px; padding-bottom:9px; border-bottom:1px solid var(--line); }
.contact-form-heading { display:flex; align-items:center; gap:10px; min-width:0; }
.contact-form-heading > a { color:var(--text); font-size:24px; line-height:1; }
.contact-form-heading h2 { margin:0; font-size:20px; white-space:nowrap; }
.contact-form-heading span { color:var(--muted); font-size:12px; }
.contact-compact-form { grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px 12px; }
.contact-compact-form label { gap:4px; }
.contact-compact-form input,.contact-compact-form select { height:36px; }
.contact-compact-form .wide { grid-column:1 / -1; }
.contact-notes-field textarea { min-height:132px; }
.contact-primary-check { display:flex; align-items:center; gap:7px; height:36px; padding:0 10px; border:1px solid var(--line-strong); border-radius:7px; background:#fff; }
.contact-primary-check input { width:auto; height:auto; margin:0; }
.contact-form-footer { grid-column:1 / -1; display:flex; align-items:flex-end; justify-content:space-between; gap:14px; }
.contact-form-footer .notice-box { flex:1; margin:0; padding:9px 12px; font-size:12px; }

/* Public-pool import controls and footer assignment. */
.pool-bulk-assign { display:flex; align-items:center; gap:8px; }
.pool-bulk-assign { margin:0; }
.pool-bulk-assign select { width:190px; height:36px; }
.pool-import-menu > form { position:absolute; top:calc(100% + 7px); right:0; z-index:45; width:340px; padding:12px; border:1px solid var(--line); border-radius:9px; background:#fff; box-shadow:0 12px 32px rgba(15,23,42,.14); }
.pool-import-menu > form label { display:grid; gap:6px; margin-bottom:8px; }
.pool-customer-table td:first-child,.pool-customer-table th:first-child { text-align:center; }
.pool-customer-table td strong,.pool-customer-table td small { display:block; }
.pool-customer-table td small { margin-top:2px; color:var(--muted); }

/* CP-style hover navigation menus in the global header. */
.nav-switch { position:relative; display:inline-flex; }
.nav-switch:hover > div,.nav-switch:focus-within > div { display:block; }
.nav-switch > div { display:none; top:calc(100% - 1px); right:auto; left:0; margin-top:0; }
.quick-menu { position:relative; display:inline-flex; }
.quick-menu:hover > div,.quick-menu:focus-within > div { display:block; }
.quick-menu > div { display:none; top:calc(100% - 1px); right:auto; left:0; margin-top:0; }
.quick-menu > div::before,.nav-switch > div::before { content:""; position:absolute; right:0; bottom:100%; width:100%; height:2px; }
.quick-menu a { display:flex; align-items:center; gap:9px; }
.quick-menu a > span { display:inline-grid; flex:0 0 25px; width:25px; height:25px; place-items:center; background:#eff6ff; border-radius:6px; font-size:14px; }

.social-profile-links { display:flex; flex-wrap:wrap; gap:7px; }
.social-profile-links a { padding:7px 10px; color:var(--primary); font-weight:700; background:#eff6ff; border:1px solid #bfdbfe; border-radius:7px; }

/* Contact detail uses the same communication records as the customer workspace. */
.contact-detail-hero { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:12px; padding:13px 16px; background:#fff; border:1px solid var(--line-strong); border-radius:var(--radius); }
.contact-detail-hero h1 { display:inline-block; margin:0 0 2px 8px; font-size:22px; }
.contact-detail-hero p { margin:2px 0 0; color:var(--muted); }
.contact-back-link { color:var(--primary); font-weight:700; }
.contact-detail-workspace { display:grid; grid-template-columns:minmax(300px,34%) minmax(0,66%); gap:14px; align-items:start; }
.contact-profile-column,.contact-communication-column { min-width:0; }
.contact-profile-column { display:grid; gap:12px; padding:14px; background:#eff6ff; border:1px solid #93c5fd; border-radius:var(--radius); }
.contact-profile-column .customer-summary-card { min-height:0; padding:14px; box-shadow:none; }
.contact-profile-column .contact-definition { display:block; }
.contact-profile-column .contact-definition div { grid-template-columns:105px minmax(0,1fr); padding:7px 0; }
.contact-profile-column .contact-definition dd { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.contact-customer-card > strong { display:block; font-size:16px; }
.contact-customer-card > p { margin:4px 0; color:var(--muted); }
.contact-customer-card > small { color:var(--muted); }
.contact-note-card > p { margin:0; white-space:normal; overflow-wrap:anywhere; }
.contact-communication-column { background:#eff6ff; border:1px solid #93c5fd; border-radius:var(--radius); }
.contact-communication-column .customer-communication-workspace { background:transparent; }

/* Compact contract create/edit form: 4 logical fields, then two rows of five. */
.contract-form-panel,.followup-form-panel { padding:14px 16px; }
.contract-form-panel > header,.followup-form-panel > header { margin-bottom:10px; padding-bottom:9px; border-bottom:1px solid var(--line); }
.contract-form-heading,.followup-form-heading { display:flex; align-items:center; gap:10px; min-width:0; }
.contract-form-heading > a,.followup-form-heading > a { color:var(--text); font-size:24px; line-height:1; }
.contract-form-heading h2,.followup-form-heading h2 { margin:0; font-size:20px; white-space:nowrap; }
.contract-form-heading span,.followup-form-heading span { color:var(--muted); font-size:12px; }
.contract-compact-form,.followup-compact-form { grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px 12px; }
.contract-compact-form > h3,.followup-compact-form > h3 { grid-column:1 / -1; margin:0; font-size:17px; }
.contract-compact-form label,.followup-compact-form label { gap:4px; }
.contract-compact-form input,.contract-compact-form select,.followup-compact-form input,.followup-compact-form select { height:36px; }
.contract-title-field,.followup-subject-field { grid-column:span 2; }
.contract-files-grid { grid-column:1 / -1; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.contract-file-picker > span,.contract-upload-field > span,.followup-files-field > span { color:var(--muted); font-size:11px; }
.contract-file-picker select,.followup-files-field select { height:92px; padding:5px 7px; }
.contract-upload-field input { height:92px; padding:28px 12px; border:1px dashed #93c5fd; background:#f8fbff; }
.contract-notes-field { grid-column:1 / -1; }
.contract-notes-field textarea { min-height:112px; }
.contract-form-footer,.followup-form-footer { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; gap:14px; }
.contract-form-footer p,.followup-form-footer p { margin:0; color:var(--muted); font-size:12px; }

/* Follow-up planner uses direct customer/contact selectors and real file relations. */
.followup-auto-note { display:flex; align-items:center; min-height:36px; padding:0 10px; color:var(--muted); background:#f8fafc; border:1px solid var(--line); border-radius:7px; }
.followup-files-field { grid-column:span 3; }
.followup-save-options { grid-column:span 2; display:flex; flex-direction:column; justify-content:center; gap:5px; min-height:92px; padding:12px; color:var(--muted); background:#f8fafc; border:1px solid var(--line); border-radius:7px; }
.followup-save-options strong { color:var(--text); }

/* Compact inquiry editor with two rows of five fields. */
.inquiry-form-panel { padding:14px 16px; }
.inquiry-form-panel > header { margin-bottom:10px; padding-bottom:9px; border-bottom:1px solid var(--line); }
.inquiry-form-heading { display:flex; align-items:center; gap:10px; min-width:0; }
.inquiry-form-heading > a { color:var(--text); font-size:24px; line-height:1; }
.inquiry-form-heading h2 { margin:0; font-size:20px; white-space:nowrap; }
.inquiry-form-heading span { color:var(--muted); font-size:12px; }
.inquiry-form-panel > .filter-bar { margin-bottom:10px; padding:9px 10px; }
.inquiry-compact-form { grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px 12px; }
.inquiry-compact-form > h3 { grid-column:1 / -1; margin:0; font-size:17px; }
.inquiry-compact-form .wide { grid-column:1 / -1; }
.inquiry-compact-form input,.inquiry-compact-form select { height:36px; }
.inquiry-requirement-field textarea { min-height:72px; }
.inquiry-compact-form .table-scroll { border:1px solid var(--line); border-radius:8px; }
.inquiry-compact-form table input { min-width:90px; }
.inquiry-attachment-field > span { color:var(--muted); font-size:11px; }
.inquiry-attachment-field select { height:88px; padding:5px 7px; }
.inquiry-form-footer { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; gap:14px; }
.inquiry-form-footer p { margin:0; color:var(--muted); font-size:12px; }

/* Compact quote editor: two five-column rows and a four-column terms section. */
.quote-form-panel { padding:14px 16px; }
.quote-form-panel > header { margin-bottom:10px; padding-bottom:9px; border-bottom:1px solid var(--line); }
.quote-form-heading { display:flex; align-items:center; gap:10px; min-width:0; }
.quote-form-heading > a { color:var(--text); font-size:24px; line-height:1; }
.quote-form-heading h2 { margin:0; font-size:20px; white-space:nowrap; }
.quote-form-heading span { color:var(--muted); font-size:12px; }
.quote-form-panel > .filter-bar { margin-bottom:10px; padding:9px 10px; }
.quote-compact-form { grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px 12px; }
.quote-compact-form > h3 { grid-column:1 / -1; margin:0; font-size:17px; }
.quote-subject-field { grid-column:span 2; }
.quote-compact-form > .wide,.quote-terms-form,.quote-notes-grid,.quote-form-footer { grid-column:1 / -1; }
.quote-compact-form input,.quote-compact-form select { height:36px; }
.quote-terms-form { padding:12px; background:#f8fafc; border:1px solid var(--line); border-radius:9px; }
.quote-terms-form > h3 { display:flex; align-items:center; gap:12px; margin:0 0 9px; font-size:17px; }
.quote-terms-form > h3 span { color:var(--muted); font-size:11px; font-weight:400; }
.quote-terms-form > div { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.quote-terms-form textarea { min-height:74px; }
.quote-special-payment { display:flex!important; flex-direction:row!important; align-items:center; gap:7px!important; margin-top:8px; }
.quote-special-payment input { width:auto; height:auto; }
.quote-notes-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.quote-notes-grid textarea { min-height:82px; }
.quote-form-footer { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.quote-form-footer p { margin:0; color:var(--muted); font-size:12px; }

/* Quote acceptance and order snapshot review. */
.order-create-panel { padding:14px 0; background:transparent; border:0; box-shadow:none; }
.order-create-panel > header { margin:0 0 12px; padding:12px 16px; background:#fff; border:1px solid var(--line-strong); border-radius:var(--radius); }
.order-create-heading { display:flex; align-items:center; gap:10px; min-width:0; }
.order-create-heading > a { color:var(--text); font-size:24px; line-height:1; }
.order-create-heading h2 { margin:0; font-size:21px; white-space:nowrap; }
.order-create-heading span { color:var(--muted); font-size:12px; }
.order-create-section { margin-bottom:12px; padding:16px; background:#fff; border:1px solid var(--line-strong); border-radius:var(--radius); }
.order-quote-confirm { border-color:#60a5fa; box-shadow:inset 0 0 0 1px #60a5fa; }
.order-create-section h3 { margin:0 0 11px; font-size:18px; }
.order-quote-loader { display:flex; align-items:end; gap:10px; }
.order-quote-loader label { flex:1; display:grid; gap:5px; color:var(--muted); font-size:12px; }
.order-quote-loader select { width:100%; height:38px; padding:0 10px; border:1px solid var(--line-strong); border-radius:7px; background:#fff; }
.order-quote-summary { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; margin-top:12px; }
.order-quote-summary div { min-width:0; padding:9px 10px; background:#f8fafc; border:1px solid var(--line); border-radius:7px; }
.order-quote-summary span,.order-quote-summary strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.order-quote-summary span { color:var(--muted); font-size:11px; }
.order-quote-summary div:last-child strong { color:var(--primary); font-size:18px; text-align:right; }
.order-select-empty { padding:24px; color:var(--muted); text-align:center; }
.order-section-title { display:flex; align-items:center; gap:18px; margin-bottom:10px; }
.order-section-title h3 { margin:0; }
.order-section-title span { color:var(--muted); font-size:12px; }
.order-fulfillment-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.order-fulfillment-grid label { display:grid; gap:5px; min-width:0; color:var(--muted); font-size:12px; }
.order-fulfillment-grid input { width:100%; height:38px; padding:0 10px; border:1px solid var(--line-strong); border-radius:7px; }
.order-fulfillment-grid textarea { min-height:64px; }
.order-snapshot-total { display:flex; align-items:center; justify-content:flex-end; gap:28px; margin-left:auto; padding:10px 14px; color:var(--muted); }
.order-snapshot-total strong { color:var(--primary); font-size:20px; }
.order-create-submit { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 16px; background:#f0fdf4; border:1px solid #86efac; border-radius:var(--radius); }
.order-create-submit > label { display:flex; align-items:flex-start; gap:9px; }
.order-create-submit input { margin-top:4px; }
.order-create-submit strong,.order-create-submit small { display:block; }
.order-create-submit small { margin-top:3px; color:var(--muted); }

/* Compact actual-payment registration workflow. */
.payment-form-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:12px; padding:12px 16px; background:#fff; border:1px solid var(--line); border-radius:var(--radius); }
.payment-form-heading > div { display:flex; align-items:center; gap:12px; min-width:0; }
.payment-form-heading h2 { margin:0; font-size:22px; }
.payment-form-heading span { color:var(--muted); white-space:nowrap; }
.payment-compact-form { display:grid; gap:12px; }
.payment-create-section { margin:0; padding:15px 18px; }
.payment-create-section h3 { margin:0 0 12px; font-size:18px; }
.payment-order-section { border-color:#60a5fa; box-shadow:inset 0 0 0 1px #60a5fa; }
.payment-order-selects { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,.75fr) auto; align-items:end; gap:12px; }
.payment-order-selects label,.payment-fields-grid label,.payment-proof-grid label { display:grid; gap:5px; min-width:0; color:var(--muted); font-size:12px; }
.payment-order-selects select,.payment-fields-grid input,.payment-fields-grid select { width:100%; height:38px; padding:0 10px; border:1px solid var(--line-strong); border-radius:7px; background:#fff; }
.payment-order-summary { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; margin-top:12px; }
.payment-order-summary div { min-width:0; padding:8px 10px; background:#f8fafc; border:1px solid var(--line); border-radius:7px; }
.payment-order-summary span,.payment-order-summary strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.payment-order-summary span { color:var(--muted); font-size:11px; }
.payment-order-summary strong { text-align:right; }
.success-text { color:#15803d; }.warning-text { color:#c2410c; }.primary-text { color:var(--primary); font-size:18px; }
.payment-section-title { display:flex; align-items:center; gap:18px; margin-bottom:12px; }
.payment-section-title h3 { margin:0; }
.payment-section-title span { color:var(--muted); font-size:12px; }
.payment-fields-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; }
.payment-fields-grid input[readonly] { color:var(--muted); background:#f8fafc; }
.payment-cny-preview { min-height:62px; padding:8px 10px; justify-content:center; background:#f8fafc; border:1px solid var(--line); border-radius:7px; }
.payment-cny-preview strong { color:var(--primary); font-size:18px; text-align:right; }
.payment-form-help { margin:8px 0 0; color:var(--muted); font-size:12px; }
.payment-proof-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.payment-proof-grid input,.payment-proof-grid textarea { width:100%; min-height:46px; padding:9px 10px; border:1px solid var(--line-strong); border-radius:7px; background:#fff; }
.payment-proof-grid textarea { height:62px; resize:vertical; }
.payment-proof-grid small { color:var(--muted); }
.payment-submit-bar { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:13px 16px; background:#f0fdf4; border:1px solid #86efac; border-radius:var(--radius); }
.payment-submit-bar strong,.payment-submit-bar small { display:block; }
.payment-submit-bar small { margin-top:3px; color:var(--muted); }

/* Four equal dashboard columns on desktop. */
.dashboard-intro { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:13px; padding:12px 16px; background:#fff; border:1px solid var(--line); border-radius:var(--radius); }
.dashboard-intro h2 { margin:0 0 3px; font-size:22px; }
.dashboard-intro p { margin:0; color:var(--muted); }
.dashboard-intro > div:last-child { display:flex; align-items:center; gap:8px; color:var(--muted); white-space:nowrap; }
.dashboard-home-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:13px; align-items:stretch; }
.dashboard-home-grid > .panel { min-width:0; margin:0; }
.dashboard-home-grid header a { color:var(--primary); font-size:12px; }
.dashboard-link-list,.dashboard-alert-list,.dashboard-receivable-list { display:grid; gap:7px; }
.dashboard-link-list a { display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:46px; padding:9px 10px; color:var(--text); background:#f8fafc; border:1px solid var(--line); border-radius:8px; }
.dashboard-link-list strong { color:var(--primary); font-size:20px; }
.dashboard-risk-card { background:#fff7f7; border-color:#fecaca; }
.dashboard-alert-list a { display:flex; align-items:center; gap:8px; min-height:39px; color:#7f1d1d; border-bottom:1px solid #fee2e2; }
.dashboard-alert-list i { flex:0 0 7px; width:7px; height:7px; background:#ef4444; border-radius:50%; }
.dashboard-flow { display:flex; align-items:center; justify-content:space-between; gap:4px; margin-bottom:12px; }
.dashboard-flow div { flex:1; min-width:0; padding:10px 5px; text-align:center; background:#eff6ff; border-radius:8px; }
.dashboard-flow strong,.dashboard-flow span { display:block; }
.dashboard-flow strong { color:var(--primary); font-size:20px; }
.dashboard-flow span { color:var(--muted); font-size:11px; }
.dashboard-flow b { color:#94a3b8; }
.dashboard-money { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 0; border-top:1px solid var(--line); }
.dashboard-money span { color:var(--muted); }
.dashboard-receivable-list > a { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 0; color:var(--text); border-bottom:1px solid var(--line); }
.dashboard-receivable-list span,.dashboard-receivable-list em { min-width:0; }
.dashboard-receivable-list strong,.dashboard-receivable-list small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dashboard-receivable-list em { color:#b45309; font-style:normal; text-align:right; white-space:nowrap; }
.dashboard-empty { display:grid; place-items:center; min-height:170px; color:var(--muted); }

.entity-name-with-thumb,.customer-contact-person,.entity-image-control { display:flex; align-items:center; gap:8px; min-width:0; }
.entity-thumb { display:block; flex:0 0 30px; width:30px; height:30px; overflow:hidden; object-fit:cover; color:#2563eb; font-size:12px; font-weight:700; line-height:30px; background:#eff6ff; border:1px solid #dbeafe; border-radius:7px; }
.entity-thumb[hidden] { display:none !important; }
.entity-thumb.contact-avatar-thumb { border-radius:50%; }
.entity-thumb.is-placeholder { text-align:center; }
.entity-name-with-thumb .record-link,.customer-contact-person span { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.customer-contact-list,.customer-contact-methods,.customer-contact-emails { display:flex; flex-wrap:wrap; align-items:flex-start; gap:6px 10px; min-width:0; white-space:normal; }
.customer-contact-person { max-width:100%; color:var(--primary); }
.customer-contact-methods { color:var(--muted); font-size:12px; }
.customer-contact-methods span { max-width:100%; overflow-wrap:anywhere; }
.customer-contact-emails a { max-width:100%; color:var(--primary); overflow-wrap:anywhere; }
.kh-customer-table .entity-name-with-thumb,.kh-customer-table .customer-contact-list,.kh-customer-table .customer-contact-methods,.kh-customer-table .customer-contact-emails { max-width:100%; overflow:hidden; flex-wrap:nowrap; white-space:nowrap; }
.entity-image-upload .entity-image-control { min-height:38px; padding:4px 8px; background:#fff; border:1px solid var(--line-strong); border-radius:7px; }
.entity-image-upload input[type="file"] { min-width:0; height:auto; padding:0; border:0; }
.entity-image-upload small { margin-left:auto; color:var(--muted); white-space:nowrap; }

.sidebar-collapsed .sidebar { width: 66px; }
.sidebar-collapsed .main-shell { margin-left: 66px; }
.sidebar-collapsed .sidebar-brand { padding: 0 15px; }
.sidebar-collapsed .sidebar-brand div, .sidebar-collapsed .nav-group h2, .sidebar-collapsed .nav-item > span:last-child, .sidebar-collapsed .sidebar-meta { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 7px; }

@media (max-width: 1180px) {
    .system-title strong, .top-link b, .user-menu summary b { display: none; }
    .topbar-left { min-width: auto; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workspace-toolbar { flex-wrap: wrap; max-height: none; }
    .workspace-toolbar .page-heading { order: 1; }
    .workspace-toolbar .module-tabs { order: 2; flex: 1 1 auto; border-right: 0; }
    .workspace-toolbar .page-actions { order: 3; }
    .workspace-filter { order: 4; flex-basis: 100%; }
    .workspace-toolbar.pool-import-toolbar { flex-wrap:wrap; max-height:none; }
    .pool-import-toolbar .workspace-filter { flex:1 0 100%; order:4; }
    .pool-heading-import { order:3; }
    .dashboard-home-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); width: min(290px, 84vw); box-shadow: 12px 0 30px rgba(15,23,42,.2); }
    .main-shell, .sidebar-collapsed .main-shell { margin-left: 0; }
    .sidebar-collapsed .sidebar { width: min(290px, 84vw); }
    .sidebar-collapsed .sidebar-brand div, .sidebar-collapsed .nav-group h2, .sidebar-collapsed .nav-item > span:last-child, .sidebar-collapsed .sidebar-meta { display: flex; }
    .sidebar-collapsed .nav-group h2 { display: block; }
    .sidebar-collapsed .nav-item { justify-content: flex-start; padding: 7px 10px; }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(15,23,42,.38); }
    .topbar { padding: 0 11px; gap: 8px; }
    .mobile-menu-button { display:inline-grid; flex:0 0 36px; }
    .system-title { display: none; }
    .global-search { min-width: 0; }
    .quick-menu .btn { width: 36px; padding: 0; font-size: 0; }
    .quick-menu .btn::before { content: "+"; font-size: 21px; }
    .top-link, .nav-switch { display: none; }
    .content-shell { padding: 10px; }
    .page-heading { align-items: flex-start; }
    .page-heading h1 { font-size: 21px; }
    .page-heading > div:first-child > p:last-child { display: none; }
    .page-actions .btn:first-child { display: none; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .filter-search, .filter-actions { grid-column: 1 / -1; }
    .workspace-toolbar { gap: 7px; padding: 7px 8px; }
    .workspace-filter .filter-bar { display: flex; }
    .workspace-filter .filter-bar label.filter-search { flex-basis: 220px; }
    .workspace-filter .filter-search, .workspace-filter .filter-actions { grid-column: auto; }
    .dashboard-grid { display: block; }
    .panel { margin-bottom: 14px; }
    .permission-grid { grid-template-columns: 1fr 1fr; }
    .customer-detail-columns,.communication-grid,.customer-detail-workspace { grid-template-columns:1fr; }
    .contact-detail-workspace { grid-template-columns:1fr; }
    .dashboard-home-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .customer-communication-workspace { min-height:0; }
    .message-compose { grid-template-columns:1fr 1fr; }
    .message-compose textarea { grid-column:1 / -1; }
    .message-compose button { grid-column:1 / -1; }
    .task-form-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .task-title-field,.task-related-field,.task-collaborators-field { grid-column:1 / -1; }
    .compact-file-form { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .compact-upload-zone,.pending-file-section,.compact-file-form .compact-form-footer { grid-column:1 / -1; }
}

@media (max-width: 640px) {
    .installer-body { padding: 18px 10px; }
    .installer-card { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .compact-task-form { padding:12px 12px 0; }
    .task-form-row { grid-template-columns:1fr; }
    .task-form-row > label { grid-column:1; }
    .compact-form-footer { align-items:stretch; flex-direction:column; margin:0 -12px; padding:10px 12px; }
    .compact-form-footer > div { width:100%; }
    .compact-form-footer .btn { flex:1; }
    .compact-file-form { grid-template-columns:1fr; padding:12px 12px 0; }
    .compact-file-form > label,.pending-file-section,.compact-file-form .compact-form-footer { grid-column:1; }
    .compact-upload-zone { flex-direction:column; min-height:150px; text-align:center; }
    .compact-upload-zone em { margin-left:0; }
    .customer-compact-form { grid-template-columns:1fr; }
    .customer-compact-form .wide { grid-column:1; }
    .contact-compact-form { grid-template-columns:1fr; }
    .contact-compact-form .wide,.contact-form-footer { grid-column:1; }
    .entity-image-upload .entity-image-control { align-items:flex-start; flex-wrap:wrap; }
    .entity-image-upload small { flex-basis:100%; margin-left:38px; }
    .contact-form-footer,.pool-management-tools,.pool-tool-actions { align-items:stretch; flex-direction:column; }
    .pool-filter-form { align-items:stretch; }
    .pool-filter-form label { justify-content:space-between; }
    .pool-filter-form select { flex:1; max-width:240px; }
    .contact-form-heading { align-items:flex-start; flex-wrap:wrap; }
    .contact-form-heading span { flex-basis:100%; }
    .pool-bulk-assign { width:100%; }
    .pool-bulk-assign select { flex:1; width:auto; }
    .pool-import-menu > form { position:fixed; top:58px; right:8px; left:8px; width:auto; }
    .customer-form-panel { padding:12px; }
    .customer-form-panel > header,.contact-detail-hero { align-items:flex-start; }
    .contact-detail-hero { padding:12px; }
    .contact-detail-hero h1 { display:block; margin:3px 0; font-size:20px; }
    .contact-detail-hero .inline-actions { flex-wrap:wrap; }
    .contract-compact-form,.followup-compact-form { grid-template-columns:1fr; }
    .inquiry-compact-form { grid-template-columns:1fr; }
    .quote-compact-form { grid-template-columns:1fr; }
    .inquiry-compact-form > h3,.inquiry-compact-form .wide,.inquiry-form-footer { grid-column:1; }
    .quote-compact-form > h3,.quote-subject-field,.quote-compact-form > .wide,.quote-terms-form,.quote-notes-grid,.quote-form-footer { grid-column:1; }
    .contract-title-field,.followup-subject-field,.contract-notes-field,.contract-files-grid,.contract-form-footer,.followup-compact-form > h3,.followup-files-field,.followup-save-options,.followup-form-footer { grid-column:1; }
    .contract-files-grid,.dashboard-home-grid { grid-template-columns:1fr; }
    .quote-terms-form > div,.quote-notes-grid { grid-template-columns:1fr; }
    .contract-form-heading,.followup-form-heading { align-items:flex-start; flex-wrap:wrap; }
    .inquiry-form-heading { align-items:flex-start; flex-wrap:wrap; }
    .quote-form-heading { align-items:flex-start; flex-wrap:wrap; }
    .contract-form-heading span,.followup-form-heading span { flex-basis:100%; }
    .inquiry-form-heading span { flex-basis:100%; }
    .quote-form-heading span { flex-basis:100%; }
    .contract-form-footer,.followup-form-footer,.dashboard-intro { align-items:stretch; flex-direction:column; }
    .inquiry-form-footer { align-items:stretch; flex-direction:column; }
    .quote-form-footer { align-items:stretch; flex-direction:column; }
    .order-create-heading,.order-quote-loader,.order-section-title,.order-create-submit { align-items:stretch; flex-direction:column; }
    .order-create-heading span { white-space:normal; }
    .order-quote-summary,.order-fulfillment-grid { grid-template-columns:1fr; }
    .payment-form-heading,.payment-section-title,.payment-submit-bar { align-items:stretch; flex-direction:column; }
    .payment-form-heading > div { align-items:flex-start; flex-wrap:wrap; }
    .payment-form-heading span { flex-basis:100%; white-space:normal; }
    .payment-order-selects,.payment-order-summary,.payment-fields-grid,.payment-proof-grid { grid-template-columns:1fr; }
    .form-grid h2, .form-actions { grid-column: 1; }
    .check-row { grid-template-columns: 16px 1fr; }
    .check-row > span:nth-child(3) { grid-column: 2; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .metric-card { min-height: 103px; padding: 13px; }
    .metric-card strong { font-size: 23px; }
    .metric-card small { font-size: 11px; }
    .filter-bar { grid-template-columns: 1fr; }
    .filter-search, .filter-actions { grid-column: 1; }
    .filter-actions .btn { flex: 1; min-height: 43px; }
    .page-heading { gap: 8px; }
    .page-actions .btn.primary { min-width: 44px; padding: 0 10px; font-size: 0; }
    .page-actions .btn.primary::before { content: "+"; font-size: 21px; }
    .module-tabs { padding: 0 12px; gap: 20px; }
    .module-tabs a { min-height: 45px; }
    .workspace-toolbar .module-tabs { padding: 0 4px; gap: 14px; }
    .workspace-toolbar .module-tabs a { min-height: 34px; }
    .table-card { background: transparent; border: 0; box-shadow: none; }
    .table-toolbar { margin-bottom: 9px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
    .table-scroll { overflow: visible; }
    table { min-width: 0; }
    table thead { display: none; }
    table, tbody, tr, td { display: block; width: 100%; }
    tbody tr { margin-bottom: 10px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
    td { border: 0; }
    .empty-state { padding: 35px 15px; }
    .pagination { justify-content: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
    .auth-body { padding: 16px 10px; }
    .auth-card { padding: 20px 16px; }
    .permission-grid { grid-template-columns: 1fr; }
.form-panel { padding:14px; }.contact-item { flex-direction:column; gap:8px; }.inline-actions { align-items:center; }.sub-tabs { margin-right:-14px; padding-right:14px; }
.contact-definition { grid-template-columns:1fr; }
.customer-detail-hero { align-items:flex-start; padding:15px; }
.customer-detail-hero h1 { font-size:20px; }
.customer-profile-column,.customer-communication-workspace { padding:13px; }
.customer-profile-column .definition-list { grid-template-columns:1fr; }
.communication-tabs { gap:7px; }
    .communication-tabs a { min-height:40px; padding:5px; font-size:13px; }
.communication-channel-toolbar { align-items:flex-start; }
.customer-conversation-box { height:390px; }
}

/* DEV7 quotation workflow */
.quote-form h3 { margin:10px 0; font-size:14px; }
.quote-form table input { width:100%; min-width:75px; height:34px; padding:0 7px; border:1px solid var(--line-strong); border-radius:6px; }
.quote-live-total { display:flex; align-items:center; justify-content:flex-end; gap:12px; padding:13px; color:var(--muted); background:#f8fafc; border-radius:8px; }
.quote-live-total strong { color:var(--primary); font-size:20px; }
.quote-live-total small { max-width:300px; }
.quote-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:0 20px; margin-bottom:15px; }
.quote-terms { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:15px 0; }
.quote-terms > div { padding:12px; background:#f8fafc; border:1px solid var(--line); border-radius:8px; }
.quote-terms p { margin:5px 0 0; color:var(--muted); }
.quote-workflow { display:flex; flex-wrap:wrap; gap:8px; padding-top:15px; border-top:1px solid var(--line); }
.quote-workflow form { display:flex; flex-wrap:wrap; gap:7px; align-items:center; }
.quote-workflow input,.quote-workflow select { height:36px; min-width:140px; padding:0 9px; border:1px solid var(--line-strong); border-radius:7px; background:#fff; }
@media (max-width:900px){.quote-summary{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:640px){.quote-summary,.quote-terms{grid-template-columns:1fr}.quote-live-total{align-items:flex-end;flex-direction:column}}

/* KH V1.0 formal modules */
.badge.danger { color:#991b1b; background:#fee2e2; }
.quick-stat-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:14px; }
.quick-stat-list a { display:flex; align-items:center; gap:10px; min-height:64px; padding:12px; color:var(--text); background:#f8fafc; border:1px solid var(--line); border-radius:8px; }
.quick-stat-list strong { color:var(--primary); font-size:24px; }
.quick-stat-list span { color:var(--muted); }
.progress-track { width:120px; max-width:100%; height:7px; overflow:hidden; background:#e5e7eb; border-radius:999px; }
.progress-track i { display:block; height:100%; background:var(--primary); border-radius:inherit; }
.notification-row.is-unread { border-left:3px solid var(--primary); background:#eff6ff; }
.inline-form { display:inline-flex; margin-left:8px; }
.inline-form button { border:0; background:none; cursor:pointer; }
@media (max-width:640px){.quick-stat-list{grid-template-columns:1fr 1fr;padding:8px}.quick-stat-list a{display:block}.quick-stat-list strong,.quick-stat-list span{display:block}}

/* Last 72 hours of staff activity on the KH workbench. */
.kh-dashboard-activity{margin-top:14px;padding:14px}.kh-dashboard-activity>header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:6px}.kh-dashboard-activity h2{margin:0;font-size:17px}.kh-dashboard-activity header p{margin:3px 0 0;color:var(--muted,#758399);font-size:11px}.kh-activity-feed{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 18px}.kh-activity-feed>article{display:grid;grid-template-columns:32px minmax(0,1fr) auto;align-items:center;gap:9px;min-height:52px;padding:7px 2px;border-top:1px solid var(--line,#e4eaf2)}.kh-activity-avatar{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:#eaf2ff;color:#1769ed;font-size:13px;font-weight:800}.kh-activity-line{display:flex;align-items:center;gap:6px;min-width:0;font-size:12px}.kh-activity-line strong{flex:0 0 auto;color:#163451}.kh-activity-line span{color:#40566d}.kh-activity-line em{flex:0 0 auto;padding:2px 5px;border-radius:4px;background:#edf4ff;color:#1769ed;font-style:normal}.kh-activity-line b{min-width:0;overflow:hidden;color:#65788b;font-weight:500;text-overflow:ellipsis;white-space:nowrap}.kh-activity-feed time{display:block;margin-top:3px;color:#8b99a8;font-size:10px}.kh-activity-feed article>i{padding:3px 7px;border-radius:10px;background:#e8f8ef;color:#0b8f4c;font-size:10px;font-style:normal}.kh-activity-feed article>i.failed{background:#fff0f0;color:#d63447}@media(max-width:900px){.kh-activity-feed{grid-template-columns:1fr}}

/* Stable customer, contact and file visuals. */
.entity-thumb-stack{position:relative;display:inline-grid;width:30px;height:30px;flex:0 0 30px;place-items:center}.entity-thumb-stack>.entity-thumb{position:absolute;inset:0}.entity-thumb-stack>img{z-index:2;background:#fff}.kh-file-cover{display:inline-grid;width:var(--cover-size,28px);height:var(--cover-size,28px);flex:0 0 var(--cover-size,28px);place-items:center;border-radius:6px;background:#edf2f7;color:#536174;font-size:9px;font-weight:800;object-fit:cover;vertical-align:middle}.kh-file-cover-pdf{background:#fff0f1;color:#d52f45}.kh-file-cover-word{background:#eaf2ff;color:#1769ed}.kh-file-cover-sheet{background:#e8f8ef;color:#118452}.kh-file-cover-slide{background:#fff3e6;color:#e46618}.kh-file-cover-video{background:#eaf7ff;color:#0878c9}.kh-file-cover-archive{background:#f4efff;color:#7450bd}

/* KH compact deal center */
.deal-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:0 0 12px}
.deal-summary-grid>a{display:flex;align-items:center;justify-content:space-between;min-height:56px;padding:10px 14px;color:var(--text);background:#fff;border:1px solid var(--line);border-radius:9px;box-shadow:var(--shadow)}
.deal-summary-grid span{color:var(--muted);font-size:12px}.deal-summary-grid strong{font-size:23px;line-height:1}
.deal-filter{margin-bottom:12px}.deal-list-card .table-toolbar{min-height:36px;padding:7px 10px}
.deal-table{table-layout:fixed;min-width:1160px}.deal-table th,.deal-table td{height:38px;padding:6px 8px;vertical-align:middle}
.deal-table th{font-size:11px}.deal-table td{font-size:12px}.deal-table td small{display:block;margin-top:2px;overflow:hidden;color:var(--muted);font-size:10px;text-overflow:ellipsis;white-space:nowrap}
.deal-table th:nth-child(1){width:15%}.deal-table th:nth-child(2){width:7%}.deal-table th:nth-child(3){width:9%}.deal-table th:nth-child(4),.deal-table th:nth-child(5),.deal-table th:nth-child(6){width:11%}.deal-table th:nth-child(7){width:12%}.deal-table th:nth-child(8){width:12%}.deal-table th:nth-child(9){width:12%}
.deal-actions{display:flex;align-items:center;gap:7px;white-space:nowrap}.deal-actions .btn{min-height:28px;padding:4px 8px;font-size:11px}
.badge.blue{color:#1456b8;background:#eaf2ff}.badge.purple{color:#6941c6;background:#f1ebff}.badge.amber{color:#a15c00;background:#fff2d8}.badge.neutral{color:#526070;background:#edf1f5}
@media(max-width:900px){.deal-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.deal-table{min-width:0}.deal-list-card .table-scroll{overflow:visible}.deal-table tr{padding:8px}.deal-table td{height:auto;min-height:35px;padding:5px 8px}.deal-table td small{white-space:normal}.deal-actions{justify-content:flex-end}}
/* KH customer workbench v2 */
.kh-workbench-head{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;margin-bottom:14px;border:1px solid var(--line,#e5eaf1);border-radius:14px;background:#fff}.kh-workbench-head p{margin:0 0 2px;color:#64748b;font-size:12px}.kh-workbench-head h2{display:inline-block;margin:0 12px 0 0;font-size:26px;color:#0f172a}.kh-workbench-head span{color:#64748b;font-size:13px}.kh-workbench-head nav{display:flex;gap:12px;align-items:center}.kh-workbench-head nav a{color:#2563eb;font-weight:700}.kh-workbench-head nav i{width:1px;height:16px;background:#dbe2ea}
.kh-dashboard-section{margin:0 0 15px}.kh-dashboard-section>header{margin:0 0 8px}.kh-dashboard-section>header h2{margin:0;color:#172033;font-size:19px}.kh-action-cards,.kh-health-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.kh-action-card,.kh-health-cards>a,.kh-opportunity-card{position:relative;display:flex;align-items:center;gap:14px;min-height:106px;padding:17px 20px;border:1px solid #e4eaf2;border-top:3px solid var(--accent);border-radius:13px;background:#fff;color:#334155;box-shadow:0 3px 12px rgba(15,23,42,.035);transition:.18s ease}.kh-action-card:hover,.kh-health-cards>a:hover,.kh-opportunity-card:hover{transform:translateY(-2px);box-shadow:0 9px 24px rgba(15,23,42,.09);border-color:color-mix(in srgb,var(--accent) 40%,#e4eaf2)}.kh-action-card.blue,.kh-opportunity-card.blue{--accent:#2563eb}.kh-action-card.cyan{--accent:#06b6d4}.kh-action-card.purple,.kh-opportunity-card.purple{--accent:#7c3aed}.kh-action-card.red,.kh-health-cards>a.red{--accent:#ef4444}.kh-opportunity-card.green,.kh-health-cards>a.green{--accent:#10b981}.kh-health-cards>a.orange{--accent:#f59e0b}.kh-card-icon{display:grid;place-items:center;flex:0 0 48px;height:48px;border-radius:12px;background:color-mix(in srgb,var(--accent) 12%,white);color:var(--accent);font-size:19px;font-weight:800}.kh-action-card div,.kh-opportunity-card div,.kh-health-cards>a div{min-width:0;display:flex;flex-direction:column}.kh-action-card small,.kh-opportunity-card small,.kh-health-cards small{font-size:14px;color:#334155}.kh-action-card strong,.kh-opportunity-card strong,.kh-health-cards strong{font-size:27px;line-height:1.15;color:#0f172a}.kh-action-card em,.kh-opportunity-card em,.kh-health-cards em{font-style:normal;color:#64748b;font-size:12px;margin-top:4px}.kh-action-card>b,.kh-health-cards>a>b,.kh-opportunity-card>i{margin-left:auto;color:#64748b;font-size:25px;font-style:normal;font-weight:400}.kh-opportunity-card em b{color:var(--accent)}
.kh-opportunity-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.kh-funnel-card{min-height:106px;padding:14px;border:1px solid #e4eaf2;border-radius:13px;background:#fff}.kh-funnel-card header{display:flex;align-items:center;justify-content:space-between;margin-bottom:9px}.kh-funnel-card h3{margin:0;font-size:14px}.kh-funnel-card header a{color:#2563eb;font-size:12px}.kh-funnel-card>div{display:grid;grid-template-columns:1fr auto 1fr auto 1fr;align-items:center;gap:5px}.kh-funnel-card>div>a{display:flex;flex-direction:column;align-items:center;padding:9px 5px;border-radius:9px;background:#eff6ff;color:#2563eb}.kh-funnel-card>div>a:last-child{background:#f5f3ff;color:#7c3aed}.kh-funnel-card>div strong{font-size:21px}.kh-funnel-card>div span{font-size:11px;color:#475569}.kh-funnel-card>div>b{color:#94a3b8}.kh-health-cards{grid-template-columns:repeat(3,minmax(0,1fr))}.kh-health-cards>a{border-top-width:1px;min-height:94px}
.kh-dashboard-bottom{display:grid;grid-template-columns:minmax(0,3fr) minmax(280px,1fr);gap:14px;align-items:start}.kh-priority-panel,.kh-risk-panel{padding:0;overflow:hidden}.kh-priority-panel>header,.kh-risk-panel>header{display:flex;align-items:flex-start;justify-content:space-between;padding:14px 16px 9px;border-bottom:1px solid #eef2f7}.kh-priority-panel h2,.kh-risk-panel h2{margin:0;font-size:17px}.kh-priority-panel>header>a,.kh-risk-panel>header>a{color:#2563eb;font-size:12px}.kh-priority-panel nav{display:flex;gap:20px;margin-top:9px}.kh-priority-panel nav a{padding-bottom:7px;color:#64748b;font-size:12px;border-bottom:2px solid transparent}.kh-priority-panel nav a.active{color:#2563eb;border-color:#2563eb;font-weight:700}.kh-priority-panel nav b{display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 4px;border-radius:5px;background:#e8f0ff;font-size:10px}.kh-priority-table{min-width:840px}.kh-priority-table th,.kh-priority-table td{padding:9px 11px;font-size:12px}.kh-customer-name{display:flex;align-items:center;gap:8px;color:#172033}.kh-customer-name>span{display:grid;place-items:center;width:29px;height:29px;border-radius:50%;background:#e9f1ff;color:#2563eb;font-weight:800}.kh-customer-name b{display:flex;flex-direction:column}.kh-customer-name small{max-width:170px;color:#94a3b8;font-weight:400;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.kh-stage-pill{display:inline-block;padding:4px 9px;border-radius:8px;background:#eef4ff;color:#2563eb}.kh-priority-table .is-overdue{color:#ef4444;font-weight:700}.kh-quick-actions{display:flex;gap:5px;white-space:nowrap}.kh-quick-actions a{padding:5px 9px;border:1px solid #bcd0f8;border-radius:6px;color:#2563eb}.kh-quick-actions a.primary{background:#2563eb;color:#fff;border-color:#2563eb}.kh-quick-actions a.whatsapp{background:#ecfdf5;color:#059669;border-color:#bbf7d0}
.kh-risk-panel>div{display:flex;flex-direction:column;padding:8px}.kh-risk-panel>div>a{display:grid;grid-template-columns:42px 1fr auto;align-items:center;gap:10px;padding:11px;border:1px solid #edf1f6;border-radius:10px;margin-bottom:7px;color:#172033}.kh-risk-panel>div>a:hover{background:#f8fafc;border-color:#cbd5e1}.kh-risk-panel span{display:grid;place-items:center;width:38px;height:38px;border-radius:10px;font-weight:800}.kh-risk-panel span.red{background:#fef2f2;color:#ef4444}.kh-risk-panel span.orange{background:#fff7ed;color:#f97316}.kh-risk-panel span.amber{background:#fffbeb;color:#d97706}.kh-risk-panel span.purple{background:#f5f3ff;color:#7c3aed}.kh-risk-panel b{display:flex;flex-direction:column;font-size:13px}.kh-risk-panel small{margin-top:3px;color:#64748b;font-weight:400}.kh-risk-panel i{font-style:normal;color:#94a3b8;font-size:22px}
@media(max-width:1200px){.kh-action-cards,.kh-opportunity-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.kh-dashboard-bottom{grid-template-columns:1fr}.kh-risk-panel>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.kh-health-cards{grid-template-columns:1fr 1fr 1fr}}
@media(max-width:760px){.kh-workbench-head{align-items:flex-start;gap:12px}.kh-workbench-head span{display:block;margin-top:4px}.kh-action-cards,.kh-opportunity-grid,.kh-health-cards{grid-template-columns:1fr}.kh-risk-panel>div{display:flex}.kh-priority-panel nav{gap:10px;overflow:auto;max-width:calc(100vw - 85px)}.kh-action-card,.kh-opportunity-card,.kh-health-cards>a{min-height:88px}.kh-workbench-head nav{white-space:nowrap}}

/* Inquiry detail layout V2 */
.inquiry-detail-panel{padding:0;overflow:hidden}.inquiry-detail-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:22px 24px;border-bottom:1px solid var(--line)}.inquiry-detail-header h2{margin:3px 0;font-size:23px}.inquiry-detail-header p{margin:0;color:var(--muted);font-size:12px}.record-kicker{color:var(--primary);font-size:11px;font-weight:800;letter-spacing:.08em}.inquiry-detail-layout{display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:18px;padding:18px;background:#f5f7fa}.inquiry-detail-main{display:grid;align-content:start;gap:14px;min-width:0}.inquiry-summary-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.inquiry-summary-grid article,.inquiry-info-card,.inquiry-action-sidebar>section{background:#fff;border:1px solid var(--line);border-radius:11px}.inquiry-summary-grid article{padding:14px}.inquiry-summary-grid span{display:block;margin-bottom:5px;color:var(--muted);font-size:11px}.inquiry-summary-grid strong{font-size:14px}.inquiry-status-dot{display:inline-block;width:7px;height:7px;margin-right:7px;border-radius:50%;background:#28a56a}.inquiry-info-card{overflow:hidden}.inquiry-info-card>header{display:flex;align-items:center;justify-content:space-between;padding:13px 16px;border-bottom:1px solid var(--line)}.inquiry-info-card>header h3{margin:0;font-size:15px}.inquiry-info-card>header span{color:var(--muted);font-size:11px}.inquiry-requirement{min-height:72px;padding:16px;line-height:1.75;white-space:normal}.inquiry-contact-grid{display:grid;grid-template-columns:repeat(2,1fr);margin:0}.inquiry-contact-grid>div{padding:13px 16px;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}.inquiry-contact-grid>div:nth-child(2n){border-right:0}.inquiry-contact-grid>div:nth-last-child(-n+2){border-bottom:0}.inquiry-contact-grid dt{color:var(--muted);font-size:11px}.inquiry-contact-grid dd{margin:4px 0 0;font-weight:700;overflow-wrap:anywhere}.inquiry-products-card .table-scroll{border:0;border-radius:0}.inquiry-products-card td>strong,.inquiry-products-card td>small{display:block}.inquiry-products-card td>small{margin-top:3px;color:var(--muted)}.price-snapshot{display:grid;gap:3px;min-width:140px}.price-snapshot span{display:flex;justify-content:space-between;gap:12px}.price-snapshot b{font-weight:600;color:var(--muted)}.inquiry-related-tabs{margin:0;background:#fff;border:1px solid var(--line);border-radius:10px}.inquiry-action-sidebar{display:grid;align-content:start;gap:12px}.inquiry-action-sidebar>section{padding:16px}.inquiry-action-sidebar h3{margin:0 0 5px;font-size:15px}.inquiry-action-sidebar p{margin:0 0 12px;color:var(--muted);font-size:11px;line-height:1.55}.stack-actions{display:grid;gap:8px}.stack-actions .btn{width:100%;text-align:center}.stack-actions select,.stack-actions input{width:100%}.inquiry-merge-table .inline-actions{gap:5px;flex-wrap:wrap}.inquiry-merge-table .inline-actions form{display:inline-flex}
@media(max-width:1100px){.inquiry-detail-layout{grid-template-columns:1fr}.inquiry-action-sidebar{grid-template-columns:repeat(2,1fr)}}
@media(max-width:760px){.inquiry-detail-header{display:grid;padding:16px}.inquiry-detail-header .inline-actions{flex-wrap:wrap}.inquiry-detail-layout{padding:10px}.inquiry-summary-grid{grid-template-columns:repeat(2,1fr)}.inquiry-contact-grid{grid-template-columns:1fr}.inquiry-contact-grid>div{border-right:0}.inquiry-contact-grid>div:nth-last-child(2){border-bottom:1px solid var(--line)}.inquiry-action-sidebar{grid-template-columns:1fr}}

/* Keep the 17-column customer and pool lists usable on tablets and phones. */
@media (min-width: 641px) and (max-width: 1100px) {
    :is(.customer-list-card,.pool-list-card) .table-scroll { overflow-x: auto; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table { min-width: 1400px; max-width: none; }
}

@media (max-width: 640px) {
    .workspace-toolbar:has(.customer-list-filter) .module-tabs { flex: 0 0 100%; order: 2; }
    .workspace-toolbar:has(.customer-list-filter) .workspace-filter {
        flex: 0 0 100%; order: 3; width: 100%; min-width: 0; overflow: visible;
    }
    .workspace-filter .customer-list-filter {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%; min-width: 0; gap: 8px; justify-content: stretch;
    }
    .workspace-filter .customer-list-filter > label,
    .workspace-filter .customer-list-filter > .filter-multi {
        display: block; width: 100%; min-width: 0; flex: none;
    }
    .workspace-filter .customer-list-filter > label > span {
        display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; line-height: 1.3;
    }
    .workspace-filter .customer-list-filter > .filter-search,
    .workspace-filter .customer-list-filter > .filter-actions { grid-column: 1 / -1; }
    .workspace-filter .customer-list-filter .filter-multi-menu { left: 0; right: 0; width: auto; }
    .workspace-filter .customer-list-filter .filter-actions { display: flex; }
    .workspace-filter .customer-list-filter .filter-actions .btn { min-height: 38px; }

    :is(.customer-list-card,.pool-list-card) .kh-customer-table { display: block; width: 100%; table-layout: auto; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table colgroup { display: none; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr {
        position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 10px; padding: 10px 12px;
    }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td {
        display: block; width: auto; max-width: none; min-width: 0; padding: 6px 0;
        overflow: visible; border: 0; text-align: left; text-overflow: clip; white-space: normal; overflow-wrap: anywhere;
    }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td::before {
        display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px;
        font-weight: 400; line-height: 1.25;
    }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:first-child {
        position: absolute; top: 10px; right: 12px; width: 24px; padding: 4px 0; text-align: center;
    }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(5) {
        grid-column: 1 / -1; grid-row: 1; padding-right: 32px; font-size: 15px; font-weight: 700;
    }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(9),
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(12),
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(14),
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(15),
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(16) { grid-column: 1 / -1; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(2)::before { content: "日期"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(3)::before { content: "客户编号"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(4)::before { content: "负责人"; }
    .pool-list-card .kh-customer-table tbody tr > td:nth-child(4)::before { content: "导入人"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(6)::before { content: "国家"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(7)::before { content: "客户类型"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(8)::before { content: "联系人"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(9)::before { content: "Email"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(10)::before { content: "电话号码"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(11)::before { content: "WhatsApp"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(12)::before { content: "官网"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(13)::before { content: "销售阶段"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(14)::before { content: "需求产品"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(15)::before { content: "备注"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td:nth-child(16)::before { content: "操作"; }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table .cell-ellipsis,
    :is(.customer-list-card,.pool-list-card) .kh-customer-table .customer-inline-field > span,
    :is(.customer-list-card,.pool-list-card) .kh-customer-table .entity-name-with-thumb,
    :is(.customer-list-card,.pool-list-card) .kh-customer-table .entity-name-with-thumb .record-link {
        width: auto; max-width: 100%; overflow: visible; text-overflow: clip; white-space: normal;
    }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td[colspan] {
        position: static; grid-column: 1 / -1; width: 100%; padding: 0;
    }
    :is(.customer-list-card,.pool-list-card) .kh-customer-table tbody tr > td[colspan]::before { content: none; }
    .customer-list-footer { flex-direction: column; align-items: stretch; padding: 10px; background: #fff; }
    .customer-list-footer .pagination { margin-left: 0; }
}

/* Conversation record controls stay beside translation status. */
.communication-record-controls{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:6px}.communication-record-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0}.communication-record-actions .communication-text-action{font:inherit;font-size:12px;border:0;background:transparent;padding:2px 0;cursor:pointer}.communication-record-actions .is-danger{color:#b91c1c}.communication-record-label{font-size:11px;color:var(--muted)}.communication-expand-link{color:var(--primary);text-decoration:underline;text-underline-offset:3px}.bilingual-message-card>header{gap:10px;flex-wrap:wrap}.bilingual-message-card>header>span{min-width:0;overflow-wrap:anywhere;flex:1 1 220px}
@media(max-width:600px){.communication-record-controls{justify-content:flex-start;max-width:100%}.communication-record-actions{gap:12px}.communication-record-actions .communication-text-action{min-height:30px}}
