:root { color: #17201d; background: #f5f7f5; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-synthesis: none; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.auth-shell { align-items: center; background: radial-gradient(circle at 75% 15%, #dcefe6, transparent 35%), #f5f7f5; display: grid; min-height: 100dvh; padding: 28px; place-items: center; }
.login-card { background: #fff; border: 1px solid #e1e8e3; border-radius: 24px; box-shadow: 0 24px 80px #18352a14; max-width: 430px; padding: 34px; width: 100%; }
.brand-mark { align-items: center; background: #173c2f; border-radius: 13px; color: #d5f36c; display: flex; font-size: 1.05rem; font-weight: 900; height: 46px; justify-content: center; letter-spacing: -.08em; width: 46px; }
.brand-mark.small { border-radius: 9px; font-size: .8rem; height: 32px; width: 32px; }
.eyebrow { color: #718079; font-size: .68rem; font-weight: 800; letter-spacing: .13em; margin: 0 0 8px; }
.login-card h1 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); letter-spacing: -.05em; line-height: 1; margin: 0; }
.intro { color: #68756f; line-height: 1.6; margin: 0; }
form { display: grid; gap: 15px; margin-top: 24px; }
label { color: #51605a; display: grid; font-size: .78rem; font-weight: 750; gap: 7px; }
input, select, textarea { background: #f7f9f7; border: 1px solid #dce5df; border-radius: 10px; color: #17201d; min-height: 46px; outline: 0; padding: 11px 13px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { background: #fff; border-color: #8dbb55; box-shadow: 0 0 0 3px #dff0c5; }
.password-input { position: relative; }
.password-input input { padding-right: 60px; }
.password-input button { background: transparent; color: #597365; font-size: .75rem; font-weight: 800; min-height: 38px; padding: 5px; position: absolute; right: 6px; top: 4px; }
.primary-button { background: #173c2f; border-radius: 10px; color: #fff; font-weight: 800; min-height: 50px; padding: 13px 18px; }
.primary-button:hover { background: #235944; }
.secondary-button, .logout-button { background: #edf2ee; border-radius: 9px; color: #375449; font-weight: 750; min-height: 40px; padding: 9px 14px; }
.message { font-size: .86rem; font-weight: 700; min-height: 1.2em; }
.message.error { color: #bd4237; }
.message.success { color: #28754b; }
.crm-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { background: #173c2f; color: #eaf5ed; display: flex; flex-direction: column; min-height: 100dvh; padding: 25px 18px 20px; }
.side-brand { align-items: center; display: flex; font-size: .9rem; font-weight: 800; gap: 11px; letter-spacing: -.02em; padding: 0 8px; }
.main-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 40px; }
.nav-group { display: flex; flex-direction: column; gap: 3px; margin-bottom: 16px; transition: margin-bottom 0.15s ease; }
.nav-group-header {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: inherit;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
  padding: 5px 8px 5px 10px;
  text-align: left;
  transition: background 0.15s ease, opacity 0.15s ease;
  user-select: none;
  width: 100%;
  box-sizing: border-box;
}
.nav-group-header:hover {
  background: rgba(255, 255, 255, 0.08);
}
.nav-group-header:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 1px;
}
.nav-group-title { font-size: 0.68rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: #78a18f; padding: 0; opacity: 0.85; display: inline-flex; align-items: center; }
.nav-group-toggle-arrow {
  align-items: center;
  color: #78a18f;
  display: inline-flex;
  height: 20px;
  justify-content: center;
  opacity: 0.75;
  transition: opacity 0.15s ease;
  width: 20px;
}
.nav-group-toggle-arrow svg {
  display: block;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-group-header:hover .nav-group-toggle-arrow {
  opacity: 1;
}
.nav-group.is-collapsed .nav-group-toggle-arrow svg {
  transform: rotate(-90deg);
}
.nav-group.is-collapsed .nav-item {
  display: none !important;
}
.nav-group.is-collapsed {
  margin-bottom: 6px;
}
.nav-group.is-collapsed.has-active .nav-group-header {
  background: rgba(255, 255, 255, 0.07);
}
.nav-group.is-collapsed.has-active .nav-group-toggle-arrow::before {
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(52, 211, 153, 0.6);
  content: '';
  display: inline-block;
  height: 6px;
  margin-right: 6px;
  width: 6px;
}
.nav-item { align-items: center; background: transparent; border-radius: 9px; color: #a8c2b5; display: flex; font-size: .88rem; font-weight: 700; gap: 12px; min-height: 42px; padding: 9px 12px; text-align: left; }
.nav-item:hover, .nav-item.active { background: #285844; color: #fff; }
.nav-item-admin { color: #fef08a !important; }
.nav-item-admin .nav-icon { color: #fef08a !important; }
.nav-item-admin:hover, .nav-item-admin.active { color: #fef9c3 !important; }
.nav-icon { color: #d5f36c; font-size: 1.15rem; line-height: 1; width: 20px; display: inline-flex; align-items: center; justify-content: center; }
.nav-icon svg { display: block; width: 18px; height: 18px; stroke-width: 2; stroke: currentColor; }
.sidebar-bottom { border-top: 1px solid #ffffff1c; display: grid; gap: 17px; margin-top: auto; padding: 20px 8px 0; }
.signed-user { align-items: center; display: flex; gap: 10px; min-width: 0; }
.avatar { align-items: center; background: #d5f36c; border-radius: 50%; color: #173c2f; display: flex; flex: 0 0 auto; font-size: .72rem; font-weight: 900; height: 34px; justify-content: center; width: 34px; }
.signed-user strong, .signed-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signed-user strong { font-size: .78rem; }
.signed-user small { color: #a8c2b5; font-size: .7rem; margin-top: 3px; }
.logout-button { background: #ffffff12; color: #d9e9df; font-size: .78rem; text-align: left; }
.workspace { min-width: 0; padding: 24px clamp(16px, 2vw, 32px) 40px; }
.topbar { align-items: center; display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.topbar h1 { font-size: 1.4rem; font-weight: 750; color: #111827; letter-spacing: -.025em; margin: 0; line-height: 1.25; }
.topbar-actions { align-items: center; display: flex; gap: 10px; padding-top: 0; }
.live-dot { color: #4d6a5a; font-size: .75rem; font-weight: 750; }
.live-dot::before { background: #83ba4e; border-radius: 50%; content: ''; display: inline-block; height: 7px; margin: 0 7px 1px 0; width: 7px; }
.stats-grid { display: grid; gap: 15px; grid-template-columns: repeat(4, 1fr); margin-bottom: 38px; }
.stat-card { background: #fff; border: 1px solid #e1e8e3; border-radius: 15px; display: grid; gap: 8px; min-height: 135px; padding: 20px; }
.stat-card.accent { background: #dff0c5; border-color: #dff0c5; }
.stat-label { color: #607168; font-size: .75rem; font-weight: 750; }
.stat-card strong { color: #173c2f; font-size: 2.25rem; letter-spacing: -.07em; line-height: 1; }
.stat-card small { color: #799087; font-size: .72rem; }
.stat-card.warning { background: #fff7e8; border-color: #f2dfb7; }
.stat-card.warning strong { color: #a8661c; }
.stat-card.success { background: #eef8e8; border-color: #d4e9c5; }
.stat-card.success strong { color: #3d7438; }
.dashboard-panel { display: grid; gap: 18px; }
.lark-dashboard-embed { position: relative; background: #fff; border: 1px solid #e1e8e3; border-radius: 15px; overflow: hidden; }
.lark-dashboard-top-mask { position: relative; height: 46px; background: #ffffff; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02); }
.lark-dashboard-frame-wrap { position: relative; width: 100%; height: min(78dvh, 900px); min-height: 640px; overflow: hidden; background: #ffffff; }
.lark-dashboard-frame-wrap iframe { border: 0; display: block; width: 100%; margin-top: 0; height: calc(100% + 50px); margin-bottom: -50px; }
.lark-dashboard-bottom-mask { position: absolute; bottom: 0; left: 0; right: 0; height: 14px; background: #ffffff; z-index: 15; pointer-events: auto; }
.lark-dashboard-click-shield { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 12; background: transparent; pointer-events: auto; cursor: default; }
.lark-dashboard-loading-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #ffffff; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity 0.4s ease, visibility 0.4s ease; }
.lark-dashboard-loading-overlay.hidden-overlay { opacity: 0; visibility: hidden; pointer-events: none; }
.lark-dashboard-blocked-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #ffffff; z-index: 28; display: flex; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
.lark-dashboard-blocked-overlay[hidden] { display: none !important; }
.lark-blocked-card { max-width: 580px; width: 100%; background: #f8fafc; border: 1.5px dashed #cbd5e1; border-radius: 16px; padding: 40px 32px; text-align: center; box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04); }
.lark-blocked-icon-wrap { width: 64px; height: 64px; margin: 0 auto 16px; background: #f1f5f9; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.lark-blocked-icon { font-size: 2rem; line-height: 1; }
.lark-blocked-title { font-size: 1.25rem; font-weight: 700; color: #0f172a; margin: 0 0 8px; }
.lark-blocked-desc { font-size: 0.92rem; color: #64748b; margin: 0 0 20px; line-height: 1.5; }
.lark-blocked-admin-box { margin-top: 16px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 18px 20px; text-align: left; }
.lark-blocked-admin-badge { display: inline-flex; align-items: center; background: #fef3c7; color: #92400e; font-size: 0.76rem; font-weight: 700; padding: 3px 10px; border-radius: 9999px; margin-bottom: 10px; }
.lark-blocked-admin-text { font-size: 0.84rem; color: #334155; margin: 0 0 16px; line-height: 1.5; }
.lark-blocked-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.lark-blocked-staff-box { margin-top: 8px; display: flex; justify-content: center; }
.lark-admin-notice-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fefce8; border: 1px solid #fef08a; border-radius: 10px; padding: 9px 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); }
.lark-admin-notice-banner[hidden] { display: none !important; }
.dashboard-loading-circle-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.dashboard-loading-spinner { position: relative; width: 124px; height: 124px; border-radius: 50%; background: conic-gradient(#0f766e 0deg, #14b8a6 120deg, #e2e8f0 240deg, #0f766e 360deg); display: flex; align-items: center; justify-content: center; animation: dashboardSpin 1.3s linear infinite; box-shadow: 0 6px 24px rgba(15, 118, 110, 0.16); }
@keyframes dashboardSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spinner-core { width: 96px; height: 96px; background: #ffffff; border-radius: 50%; display: flex; align-items: center; justify-content: center; animation: dashboardSpinReverse 1.3s linear infinite; box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.06); }
@keyframes dashboardSpinReverse { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
.spinner-text { font-weight: 900; font-size: 0.88rem; letter-spacing: 2px; color: #0f766e; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.loading-status-text { font-weight: 700; font-size: 0.95rem; color: #1e293b; margin-top: 4px; }
.loading-sub-text { font-size: 0.8rem; color: #64748b; }
.dashboard-toolbar { align-items: end; display: flex; justify-content: space-between; gap: 20px; }
.dashboard-period-label { color: #304b3d; font-size: .92rem; font-weight: 800; margin: 0; }
.dashboard-periods { background: #eaf0eb; border-radius: 10px; display: flex; gap: 3px; padding: 4px; }
.dashboard-period { background: transparent; border-radius: 7px; color: #6d8075; font-size: .75rem; font-weight: 800; min-height: 34px; padding: 7px 12px; }
.dashboard-period:hover, .dashboard-period.active { background: #fff; box-shadow: 0 2px 8px #173c2f10; color: #173c2f; }
.dashboard-filters { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashboard-filters select { background: #fff; font-size: .78rem; }
.dashboard-stats { grid-template-columns: repeat(4, 1fr); margin: 0; }
.dashboard-stats .stat-card { min-height: 125px; padding: 17px; }
.dashboard-stats .stat-card strong { font-size: 1.95rem; }
.dashboard-chart-tabs-bar {
  margin: 16px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.dashboard-chart-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: thin;
  background: #f8fafc;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.dashboard-chart-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
  user-select: none;
  white-space: nowrap;
}
.dashboard-chart-tab:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}
.dashboard-chart-tab.active {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 118, 110, 0.25);
}
.dashboard-chart-tab.active:hover {
  background: #115e59;
  border-color: #115e59;
}

.dashboard-chart-tab-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  border: 1.5px dashed #0f766e;
  border-radius: 7px;
  color: #0f766e;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}
.dashboard-chart-tab-add:hover {
  background: #ecfdf5;
  border-color: #0d9488;
  color: #0d9488;
  transform: translateY(-1px);
}
.dashboard-tab-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.7;
  font-size: 0.76rem;
  line-height: 1;
  transition: opacity 0.15s ease, transform 0.15s ease;
  color: inherit;
}
.dashboard-tab-edit-btn:hover {
  opacity: 1;
  transform: scale(1.15);
  background: rgba(0, 0, 0, 0.08);
}
.dashboard-chart-tab.active .dashboard-tab-edit-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
.tab-chart-badge {
  font-size: 0.72rem;
  opacity: 0.85;
  font-weight: 500;
  margin-left: 2px;
}
.dashboard-view-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dashboard-view-checkbox-item:hover {
  background: #f0fdfa;
  border-color: #99f6e4;
}
.dashboard-view-checkbox-item input[type="checkbox"] {
  margin-top: 3px;
  cursor: pointer;
  width: 16px;
  height: 16px;
}
.dashboard-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-grid.single-chart-view {
  grid-template-columns: 1fr;
}
.dashboard-grid.single-chart-view .chart-card {
  grid-column: 1 / -1;
}
.dashboard-grid.single-chart-view .chart-card-focused {
  border-color: #0f766e;
  box-shadow: 0 4px 16px rgba(15, 118, 110, 0.08);
  padding: 24px;
}
.dashboard-grid.single-chart-view .trend-svg {
  height: 300px;
}
.chart-card { background: #fff; border: 1px solid #e1e8e3; border-radius: 15px; min-width: 0; padding: 20px; }
.chart-card-wide { grid-column: span 2; }
.chart-heading { align-items: start; display: flex; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.chart-heading h2 { color: #243d31; font-size: 1.05rem; letter-spacing: -.035em; margin: 0; }
.chart-note { color: #92a098; font-size: .7rem; padding-top: 2px; text-align: right; }
.chart-area { min-height: 250px; }
.chart-empty { align-items: center; color: #93a097; display: flex; font-size: .78rem; justify-content: center; min-height: 190px; text-align: center; }
.chart-legend { color: #75877c; display: flex; font-size: .7rem; gap: 17px; margin-bottom: 4px; }
.chart-legend span { align-items: center; display: inline-flex; gap: 6px; }
.legend-dot { border-radius: 50%; display: inline-block; height: 7px; width: 7px; }
.legend-dot.leads { background: #83ba4e; }
.legend-dot.followups { background: #173c2f; }
.trend-svg { display: block; height: 220px; overflow: visible; width: 100%; }
.trend-svg line { stroke: #e9efea; stroke-width: 1; }
.trend-svg text { fill: #93a098; font-size: 11px; }
.trend-line { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.trend-line.leads { stroke: #83ba4e; }
.trend-line.followups { stroke: #173c2f; }
.bar-list, .funnel-list { display: grid; gap: 15px; }
.bar-row { display: grid; gap: 7px; }
.bar-label { align-items: baseline; display: flex; font-size: .75rem; gap: 8px; justify-content: space-between; }
.bar-label strong { color: #385246; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-label span { color: #89978f; flex: 0 0 auto; font-size: .68rem; }
.bar-track, .funnel-track { background: #edf2ed; border-radius: 20px; height: 8px; overflow: hidden; }
.bar-track svg, .funnel-track svg { display: block; height: 8px; width: 100%; }
.bar-track rect { fill: #6da644; }
.funnel-row { align-items: center; display: grid; gap: 10px; grid-template-columns: 54px minmax(0, 1fr) 38px; }
.funnel-level { color: #536b5c; font-size: .72rem; font-weight: 850; }
.funnel-track rect { fill: #4d8860; }
.funnel-row strong { color: #294636; font-size: .75rem; text-align: right; }
.sales-table-wrap { overflow-x: auto; }
.sales-table { border-collapse: collapse; min-width: 520px; width: 100%; }
.sales-table th { color: #91a098; font-size: .67rem; letter-spacing: .06em; padding: 0 12px 10px; text-align: left; text-transform: uppercase; }
.sales-table td { border-top: 1px solid #edf1ed; color: #4f6658; font-size: .78rem; padding: 12px; }
.sales-table td:first-child { color: #263f32; font-weight: 800; }
.sales-table td:last-child { color: #4c8a3f; }
.content-grid { display: grid; gap: 28px; grid-template-columns: minmax(320px, 1.1fr) minmax(0, 2.2fr); }
.campaign-panel { min-width: 0; }
.campaign-heading { align-items: start; display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.campaign-title-line { align-items: baseline; display: flex; gap: 10px; }
.campaign-title-line h2 { margin: 0; }
.campaign-count { color: #4d7837; font-size: .78rem; font-weight: 800; }
.campaign-heading .muted { margin: 0; }
.campaign-status { font-size: .7rem; margin-top: 4px !important; }
.campaign-actions { align-items: center; display: flex; gap: 13px; }
.campaign-tabs { border-bottom: 1px solid #dce5df; display: flex; gap: 5px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 0; scrollbar-width: thin; }
.campaign-tab { align-items: center; background: transparent; border-bottom: 2px solid transparent; color: #718079; display: inline-flex; flex: 0 0 auto; font-size: .78rem; font-weight: 800; gap: 8px; min-height: 42px; padding: 8px 12px; }
.campaign-tab:hover, .campaign-tab.active { border-bottom-color: #83ba4e; color: #173c2f; }
.campaign-tab-index { align-items: center; background: #edf2ee; border-radius: 50%; color: #6b7d72; display: inline-flex; font-size: .66rem; height: 22px; justify-content: center; width: 22px; }
.campaign-tab.active .campaign-tab-index { background: #d5f36c; color: #173c2f; }
.campaign-purpose { border-bottom: 1px solid #e1e8e3; margin-bottom: 14px; padding: 0 0 12px; }
.campaign-purpose-row { min-height: 36px; }
.campaign-description-trigger { background: transparent; color: #718079; display: block; font-size: .82rem; min-height: 36px; overflow: hidden; padding: 4px 0; text-align: left; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.campaign-description-trigger:hover { color: #173c2f; }
.campaign-description-trigger:focus-visible { border-radius: 4px; outline: 3px solid #dff0c5; outline-offset: 3px; }
.campaign-description { color: #41584b; font-size: .82rem; line-height: 1.55; margin: 0; max-width: 820px; white-space: pre-wrap; }
.campaign-description-trigger.campaign-description { white-space: nowrap; }
.campaign-description-form { align-items: center; display: flex; gap: 10px; margin: 0; }
.campaign-description-form input { background: transparent; border: 0; border-bottom: 1px solid #9fc76a; border-radius: 0; min-height: 36px; padding: 5px 0; }
.campaign-description-form input:focus { box-shadow: none; }
.campaign-description-form .message { font-size: .72rem; min-height: 0; }
.email-history-section { background: #fff; border: 1px solid #e1e8e3; border-radius: 12px; display: grid; gap: 12px; margin-top: 16px; padding: 14px; }
.email-history-section-head { align-items: center; display: flex; justify-content: space-between; }
.email-history-section-head strong { color: #243d31; font-size: .82rem; }
.campaign-email-history { display: grid; gap: 8px; }
.campaign-workspace { display: grid; gap: 28px; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
dialog#campaignPancakeDialog, dialog#campaignEmailDialog { max-width: min(1400px, calc(100vw - 30px)); }
.campaign-channel-tabs { border-bottom: 2px solid #cbd5e1; display: flex; gap: 8px; margin: 6px 0 18px; }
.campaign-channel-tab { background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 8px 8px 0 0; color: #475569; cursor: pointer; font-size: .85rem; font-weight: 700; min-height: 42px; padding: 9px 20px; transition: all .15s ease; }
.campaign-channel-tab:hover { color: #0f172a; background: #e2e8f0; }
.campaign-channel-tab.active { background: #1d4ed8 !important; border-color: #1e40af !important; color: #ffffff !important; font-weight: 800; box-shadow: 0 2px 6px rgba(29, 78, 216, 0.35); }
.campaign-channel-pane { display: grid; gap: 14px; }
.campaign-marketing-layout { align-items: start; display: grid; gap: 18px; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 360px); }
.campaign-suggestions-sidebar { background: #fff; border: 1px solid #e1e8e3; border-radius: 11px; min-width: 0; overflow: hidden; }
.campaign-suggestions-sidebar .pancake-suggestions { max-height: min(75vh, 750px); overflow-y: auto; }
.campaign-suggestions-sidebar .suggestions-list { max-height: none; }
.campaign-email-composer { min-width: 0; }
@media (max-width: 760px) { .campaign-marketing-layout { grid-template-columns: 1fr; } .campaign-suggestions-sidebar { order: 2; } }
.campaign-list-column { min-width: 0; }
.campaign-list-heading { align-items: baseline; display: flex; gap: 10px; justify-content: space-between; margin-bottom: 10px; }
.campaign-list-heading .eyebrow { margin: 0; }
.campaign-list { max-height: min(72dvh, 2200px); }
.campaign-composer-tabs { border-bottom: 1px solid #e1e8e3; display: flex; gap: 4px; margin: -2px 0 2px; }
.campaign-composer-tab { background: transparent; border-bottom: 2px solid transparent; color: #718079; font-size: .74rem; font-weight: 800; min-height: 40px; padding: 8px 10px; }
.campaign-composer-tab:hover, .campaign-composer-tab.active { border-bottom-color: #70a92f; color: #365344; }
.campaign-composer-tab:focus-visible { border-radius: 4px; outline: 3px solid #dff0c5; outline-offset: 2px; }
#campaignPancakeComposer { display: grid; gap: 14px; }
.campaign-image-preview { align-items: center; background: #f7faf5; border: 1px solid #dce8d4; border-radius: 9px; display: flex; gap: 10px; padding: 8px 10px; }
.campaign-image-preview img { border-radius: 7px; height: 58px; object-fit: contain; width: 58px; }
.campaign-image-preview span { color: #55705f; font-size: .72rem; }
.email-history-row { background: #f7faf5; border: 1px solid #dce8d4; border-radius: 10px; display: grid; gap: 8px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; padding: 12px; }
@media (max-width: 760px) { .email-history-row { grid-template-columns: 1fr; } }
.email-history-row strong { color: #173c2f; font-size: .78rem; }
.email-history-row small { color: #62766b; display: block; font-size: .72rem; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-history-row div:nth-child(2) { display: grid; gap: 3px; }
.email-history-row div:nth-child(2) span { color: #62766b; font-size: .7rem; }
.email-history-status { align-items: center; display: flex; flex-direction: column; gap: 8px; justify-content: center; text-align: center; }
.email-history-status > :first-child { background: #edf4df; border-radius: 20px; color: #456b33; font-size: .66rem; font-weight: 800; padding: 4px 8px; }
.email-history-actions { display: flex; gap: 6px; }
.email-history-actions button { background: #fff; border: 1px solid #d4dfcd; border-radius: 7px; color: #456b33; font-size: .66rem; font-weight: 700; min-height: 30px; padding: 0 10px; }
.email-history-actions button:hover { background: #edf4df; }
.email-history-actions button:disabled { cursor: wait; opacity: .55; }
.lead-column, .detail-panel { min-width: 0; }
.section-title { align-items: end; display: flex; justify-content: space-between; margin-bottom: 17px; }
.section-title-actions { align-items: center; display: flex; gap: 12px; }
.section-title h2 { font-size: 1.35rem; letter-spacing: -.04em; margin: 0; }
.result-count { color: #87958d; font-size: .75rem; }
.period-tabs { border-bottom: 1px solid #dce5df; display: flex; gap: 4px; margin-bottom: 13px; overflow-x: auto; scrollbar-width: thin; }
.period-tab { background: transparent; border-bottom: 2px solid transparent; color: #77877e; flex: 0 0 auto; font-size: .76rem; font-weight: 800; min-height: 38px; padding: 7px 11px; }
.period-tab:hover, .period-tab.active { border-bottom-color: #83ba4e; color: #173c2f; }
.filters { display: grid; gap: 7px; grid-template-columns: repeat(var(--lead-filter-cols, 3), minmax(0, 1fr)); margin-bottom: 9px; align-items: center; }
.lead-dynamic-filters { display: contents; }
.search-field { align-items: center; background: #fff; border: 1px solid #d8e2ec; border-radius: 6px; display: flex; gap: 6px; padding: 0 8px; height: 31px; min-height: 31px; max-height: 31px; box-sizing: border-box; }
.search-field span { color: #94a3b8; font-size: 0.8rem; line-height: 1; flex-shrink: 0; }
.search-field input { background: transparent; border: 0; height: 100%; width: 100%; font-size: 0.74rem; font-weight: 500; color: #1e293b; padding: 0; min-height: auto; outline: none; }
.search-field input:focus { box-shadow: none; }
.filters select { background: #fff; font-size: .74rem; font-weight: 500; color: #334155; height: 31px; min-height: 31px; max-height: 31px; box-sizing: border-box; border: 1px solid #d8e2ec; border-radius: 6px; padding: 0 22px 0 8px; width: 100%; min-width: 0; }
.lead-list { display: grid; gap: 8px; max-height: min(72dvh, 2200px); overflow: auto; overscroll-behavior: contain; padding: 0 5px 5px 0; scrollbar-gutter: stable; scrollbar-width: thin; }
.lead-list-more { color: #89968f; font-size: .72rem; padding: 10px; text-align: center; }
.lead-table-head, .lead-card { align-items: center; display: grid; gap: 13px; grid-template-columns: var(--lead-columns, minmax(190px, 1.7fr) minmax(105px, .85fr) 105px 90px 115px); }
.lead-table-head { color: #89968f; font-size: .68rem; font-weight: 800; letter-spacing: .06em; padding: 0 18px 7px; text-transform: uppercase; }
.lead-card { background: #fff; border: 1px solid #e1e8e3; border-radius: 13px; contain: layout paint; content-visibility: auto; contain-intrinsic-size: 72px; cursor: pointer; padding: 12px 18px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.lead-card:hover, .lead-card.selected { border-color: #9fc76a; box-shadow: 0 8px 22px #173c2f0d; transform: translateY(-1px); }
.lead-name { align-items: center; display: flex; gap: 11px; min-width: 0; }
.lead-avatar { align-items: center; background: #edf4df; border-radius: 10px; color: #58773e; display: flex; flex: 0 0 auto; font-size: .78rem; font-weight: 900; height: 38px; justify-content: center; width: 38px; }
.lead-name strong, .lead-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-name strong { font-size: .9rem; }
.lead-list:not(.campaign-list) .lead-name { align-items: flex-start; }
.lead-list:not(.campaign-list) .lead-name strong { overflow-wrap: anywhere; text-overflow: clip; white-space: normal; }
.lead-list:not(.campaign-list) .lead-name > div { min-width: 0; }
.lead-name small, .lead-sale, .lead-date { color: #819087; font-size: .73rem; margin-top: 4px; }
.lead-sale, .lead-date { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-level { min-width: 0; }
.level-pill { background: #f0f4ee; border-radius: 20px; color: #55705f; display: inline-block; font-size: .68rem; font-weight: 800; padding: 5px 8px; }
.empty-state, .empty-detail { color: #89968f; padding: 50px 20px; text-align: center; }
.error-state { color: #bd4237; }
.loading-state { align-items: center; color: #718079; display: flex; font-size: .82rem; gap: 10px; justify-content: center; min-height: 150px; }
.loading-spinner { animation: spin .8s linear infinite; border: 3px solid #dce8d7; border-radius: 50%; border-top-color: #6da644; height: 22px; width: 22px; }
.loading-spinner.small { border-width: 2px; display: inline-block; height: 11px; margin-right: 4px; vertical-align: -1px; width: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
.detail-panel { background: #fff; border: 1px solid #e1e8e3; border-radius: 16px; min-height: 490px; }
.detail-panel-label { padding: 22px 25px 0; }
.detail-panel-label .eyebrow { margin-bottom: 0; }
.detail-view-tabs { border-bottom: 1px solid #e1e8e3; display: flex; gap: 5px; overflow-x: auto; }
.detail-view-tab { background: transparent; border-bottom: 2px solid transparent; color: #718079; font-size: .7rem; font-weight: 850; letter-spacing: .06em; min-height: 42px; padding: 8px 10px; white-space: nowrap; }
.detail-view-tab:hover, .detail-view-tab.active { border-bottom-color: #1e40af; color: #1e40af; }
.detail-conversation-tab { align-items: center; display: inline-flex; gap: 6px; }
.detail-conversation-channel-icons { align-items: center; display: inline-flex; gap: 3px; margin-left: 2px; }
.detail-conversation-channel-icon .pancake-platform-icon { font-size: .62rem; height: 16px; width: 16px; }
.detail-tab-content { min-width: 0; }
.detail-content { padding: 25px; }
.detail-top { align-items: flex-start; display: flex; gap: 13px; justify-content: space-between; }
.detail-heading { display: flex; gap: 12px; min-width: 0; }
.detail-heading h2 { font-size: 1.5rem; letter-spacing: -.05em; margin: 0; overflow-wrap: anywhere; }
.detail-heading p { color: #76857c; font-size: .77rem; margin: 5px 0 0; }
.care-button { background: #d5f36c; border-radius: 9px; color: #173c2f; font-size: .76rem; font-weight: 850; padding: 11px 13px; white-space: nowrap; }
.campaign-care-cell { min-width: 0; }
.campaign-care-button { font-size: .68rem; min-height: 34px; padding: 7px 9px; }
.campaign-care-button.campaign-care-recontact, .care-button.care-button-recontact { background: #fff0b8; color: #765b19; }
.campaign-care-button.campaign-care-recontact:hover, .care-button.care-button-recontact:hover { background: #ffe79a; }
.care-button:hover { background: #c7e85b; }
.care-button:disabled { background: #eef2ef; color: #7b8b82; cursor: not-allowed; font-size: .7rem; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 22px 0; }
.detail-tag { background: #f1f5f1; border-radius: 7px; color: #5f7267; font-size: .7rem; font-weight: 750; padding: 7px 9px; }
.detail-section { border-top: 1px solid #e9eeea; padding: 18px 0 0; }
.detail-section + .detail-section { margin-top: 18px; }
.detail-section h3 { color: #63736a; font-size: .7rem; letter-spacing: .1em; margin: 0 0 10px; text-transform: uppercase; }
.detail-section p { color: #384b40; font-size: .82rem; line-height: 1.55; margin: 0; white-space: pre-wrap; }
.detail-facts { display: grid; gap: 13px; grid-template-columns: 1fr 1fr; }
.fact span { color: #8a9990; display: block; font-size: .68rem; margin-bottom: 4px; }
.fact strong { font-size: .79rem; overflow-wrap: anywhere; }
.timeline { display: grid; gap: 0; }
.timeline-item { border-left: 2px solid #d5f36c; margin-left: 4px; padding: 0 0 17px 15px; position: relative; }
.timeline-item::before { background: #9fc76a; border: 3px solid #fff; border-radius: 50%; content: ''; height: 7px; left: -6px; position: absolute; top: 1px; width: 7px; }
.timeline-item strong { display: block; font-size: .78rem; }
.timeline-item small { color: #829087; display: block; font-size: .7rem; margin-top: 4px; }
.timeline-item p { font-size: .76rem; margin-top: 7px; }
.empty-icon { color: #bad18e; font-size: 3rem; }
.empty-detail h3 { color: #43564b; font-size: 1rem; margin: 10px 0 6px; }
.empty-detail p { font-size: .8rem; line-height: 1.5; margin: 0 auto; max-width: 230px; }
dialog { background: transparent; border: 0; max-width: min(680px, calc(100vw - 30px)); padding: 0; width: 100%; }
#careDialog { max-width: min(980px, calc(100vw - 30px)); }
#addLeadDialog { max-width: min(860px, calc(100vw - 30px)); }
dialog::backdrop { background: #10251e80; backdrop-filter: blur(3px); }
.care-form { background: #fff; border-radius: 18px; gap: 16px; margin: 0; max-height: 92dvh; overflow-y: auto; padding: 32px; }
.dialog-head { align-items: flex-start; display: flex; justify-content: space-between; }
.dialog-head h2 { font-size: 1.5rem; letter-spacing: -.05em; margin: 3px 0 0; }
.icon-button { background: #eef2ef; border-radius: 50%; color: #52655a; font-size: 1.35rem; height: 34px; width: 34px; }
.dialog-lead { background: #f1f6eb; border-radius: 8px; color: #55743d; font-size: .78rem; font-weight: 800; margin: 0; padding: 10px 12px; }
.form-two { display: grid; gap: 13px; grid-template-columns: 1fr 1fr; }
.lead-channel-hint { background: #f7faf5; border: 1px solid #dce8d4; border-radius: 10px; color: #55705f; display: grid; gap: 4px; padding: 11px 13px; }
.lead-channel-hint strong { color: #365344; font-size: .78rem; }
.lead-channel-hint span { font-size: .74rem; line-height: 1.45; }
#careContent, #careNote, #careInsight, #rejectionReason { min-height: 118px; resize: vertical; }
@media (max-width: 760px) { .content-grid, .campaign-workspace { grid-template-columns: 1fr; } .detail-panel { min-height: auto; } }
@media (max-width: 1180px) { .dashboard-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px) { .crm-shell { display: block; } .sidebar { min-height: auto; padding: 14px 16px; } .main-nav { display: flex; gap: 4px; margin: 18px 0 0; overflow-x: auto; } .nav-item { flex: 0 0 auto; } .sidebar-bottom { align-items: center; border: 0; display: flex; justify-content: space-between; margin: 14px 0 0; padding: 0; } .workspace { padding: 28px 18px 50px; } .stats-grid, .dashboard-stats { grid-template-columns: repeat(2, 1fr); } .dashboard-grid { grid-template-columns: 1fr; } .chart-card-wide { grid-column: auto; } }
@media (max-width: 800px) { .lark-dashboard-frame-wrap { height: 72dvh; min-height: 520px; } }
@media (max-width: 760px) { .lead-list { padding-bottom: 4px; } .lead-table-head, .lead-card { min-width: min-content; } }
@media (max-width: 590px) { .login-card { padding: 30px 23px; } .topbar { display: block; } .topbar-actions { justify-content: space-between; padding-top: 20px; } .dashboard-toolbar { align-items: start; display: block; } .dashboard-periods { margin-top: 13px; overflow-x: auto; width: max-content; max-width: 100%; } .dashboard-filters { grid-template-columns: 1fr; } .filters { grid-template-columns: 1fr 1fr; } .search-field { grid-column: 1 / -1; } .campaign-heading { display: block; } .campaign-actions { justify-content: space-between; margin-top: 17px; } .campaign-description-actions { align-items: stretch; flex-direction: column; } .campaign-description-actions .primary-button { width: 100%; } .lead-list { max-height: 70dvh; } .lead-table-head { display: none; } .lead-card { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) auto; min-width: 0; padding: 14px; } .lead-card > [data-label]::before { color: #9aa69f; content: attr(data-label); display: block; font-size: .62rem; font-weight: 800; margin-bottom: 3px; } .lead-name { grid-row: span 2; } .lead-sale, .lead-date, .lead-level { margin-top: 0; text-align: right; } .form-two { grid-template-columns: 1fr; } .care-form { padding: 21px; } }
.pancake-toolbar, .pancake-link-row { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; margin-bottom: 9px; }
.pancake-link-row { grid-template-columns: minmax(0, 1fr) auto; }
.pancake-toolbar select, .pancake-toolbar input, .pancake-link-row select { background: #f7f9f7; min-height: 40px; }
.pancake-toolbar .secondary-button:disabled, .pancake-link-row .secondary-button:disabled { cursor: wait; opacity: .65; }
.pancake-platform-tabs { display: flex; gap: 7px; margin-bottom: 10px; overflow-x: auto; }
.pancake-platform-tab { align-items: center; background: #f1f5f1; border: 1px solid transparent; border-radius: 9px; color: #5d7165; display: inline-flex; font-size: .72rem; font-weight: 800; gap: 5px; padding: 8px 10px; white-space: nowrap; }
.pancake-platform-tab.active { background: #173c2f; border-color: #173c2f; color: #fff; }
.pancake-open-tab { margin-left: auto; text-decoration: none; }
.pancake-open-tab:not(:disabled) { background: #edf4df; border-color: #dbe8ca; color: #55743d; }
.pancake-open-tab:disabled, .pancake-open-tab[aria-disabled="true"] { cursor: not-allowed; opacity: .5; }
.pancake-platform-tab .pancake-platform-icon { height: 19px; width: 19px; }
.pancake-link-status { align-items: center; color: #55705f; display: flex; font-size: .72rem; gap: 5px; margin: 0 0 9px; }
.pancake-link-status .pancake-platform-icon { height: 18px; width: 18px; }
.pancake-load-button { background: #1683e8; border: 1px solid #0d6fcb; color: #fff; font-weight: 850; margin-left: 5px; }
.pancake-load-button:hover { background: #0d6fcb; }
.pancake-load-button:disabled { background: #78b7ed; color: #fff; }
.pancake-linked { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.pancake-linked-button { background: #edf4df; border-radius: 8px; color: #55743d; font-size: .72rem; font-weight: 800; padding: 8px 10px; }
.pancake-linked-button.active { background: #173c2f; color: #fff; }
.pancake-thread { border: 1px solid #e1e8e3; border-radius: 11px; overflow: hidden; }
.pancake-thread-head { align-items: center; background: #f1f6eb; display: flex; justify-content: space-between; padding: 10px 12px; }
.pancake-thread-head strong { color: #365344; font-size: .78rem; }
.pancake-thread-actions { align-items: center; display: flex; gap: 8px; }
.pancake-refresh-status { color: #6d8799; font-size: .72rem; font-weight: 500; transition: all .25s ease; }
.pancake-refreshing-bar { align-items: center; animation: fadeIn .2s ease; background: #f0f7ff; border-bottom: 1px solid #dbeafe; color: #1d4ed8; display: flex; font-size: .73rem; font-weight: 500; gap: 6px; justify-content: center; padding: 5px 12px; }
.pancake-messages.is-refreshing { opacity: .65; pointer-events: none; transition: opacity .2s ease; }
.pancake-chat-layout { align-items: start; display: grid; gap: 12px; grid-template-columns: minmax(0, 1.7fr) minmax(250px, .75fr); }
.content-grid.chat-mode-active {
  grid-template-columns: minmax(320px, 1.1fr) minmax(0, 2.2fr) !important;
}
@media (max-width: 900px) {
  .content-grid,
  .content-grid.chat-mode-active {
    grid-template-columns: 1fr !important;
  }
}
.lead-chat-side-info {
 background: #fff;
 border: 1px solid #e1e8e3;
 border-radius: 16px;
 padding: 18px 20px;
 max-height: min(85dvh, 1200px);
 overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}
.lead-chat-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e9eeea;
}
.lead-chat-side-head h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #173c2f;
  font-weight: 800;
}
.back-to-list-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #edf4df;
  border: 1px solid #cce0b8;
  border-radius: 7px;
  color: #3f6029;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.back-to-list-btn:hover {
  background: #dfecc8;
  color: #173c2f;
}
.pancake-chat-main { min-width: 0; }
.pancake-suggestions-column { background: #fff; border: 1px solid #e1e8e3; border-radius: 11px; min-width: 0; overflow: hidden; position: sticky; top: 10px; }
.pancake-suggestions-column-head { background: #f1f6eb; border-bottom: 1px solid #e1e8e3; display: grid; gap: 3px; padding: 11px 12px; }
.pancake-suggestions-column-head strong { color: #365344; font-size: .78rem; }
.pancake-suggestions-column-head .muted { font-size: .66rem; }
.pancake-suggestions-column .pancake-suggestions { max-height: min(70dvh, 680px); overflow-y: auto; }
.pancake-suggestions-column .suggestions-list { gap: 6px; max-height: none; }
.pancake-suggestions-column .suggestion-card { gap: 5px; padding: 6px 7px; }
.pancake-suggestions-column .suggestion-card-body { gap: 6px; }
.pancake-suggestions-column .suggestion-card strong { font-size: .7rem; }
.pancake-suggestions-column .suggestion-card span { font-size: .64rem; line-height: 1.25; }
.pancake-suggestions-column .suggestion-card-copy > span:last-child { max-height: 6.25em; }
.pancake-suggestions-column .suggestion-card .suggestion-code { font-size: .58rem; }
.pancake-suggestions-column .suggestion-thumbnail { padding: 3px; width: 62px; }
.pancake-suggestions-column .suggestion-thumbnail img { height: 54px; width: 54px; }
.pancake-suggestions-column .suggestion-thumbnail small { font-size: .52rem; }
.pancake-suggestions-column .suggestion-use-button { font-size: .64rem; min-height: 26px; padding: 0 8px; }
.pancake-chat-main .pancake-composer-tabs, .pancake-chat-main #pancakeSuggestions { display: none !important; }
.pancake-messages {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(68dvh, 680px);
  min-height: 320px;
  overflow-y: auto;
  padding: 10px 12px;
}
.pancake-message {
  align-self: flex-start;
  background: #f0f2f5;
  border: 1px solid #e2e8f0;
  border-radius: 12px 12px 12px 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  display: inline-flex;
  flex-direction: column;
  max-width: 82%;
  min-width: 48px;
  padding: 5px 9px 4px;
  word-break: break-word;
  position: relative;
  margin-bottom: 2px;
}
.pancake-message.staff {
  align-self: flex-end;
  background: #eef6ff;
  border-color: #cde2fe;
  border-radius: 12px 12px 4px 12px;
}
.pancake-message.is-consecutive {
  margin-top: -1px;
}
.pancake-message.staff.is-consecutive {
  border-top-right-radius: 5px;
}
.pancake-message.incoming.is-consecutive {
  border-top-left-radius: 5px;
}
.pancake-message-meta {
  align-items: center;
  display: flex;
  gap: 4px;
  line-height: 1.2;
  margin-bottom: 2px;
}
.pancake-message-sender {
  color: #0369a1;
  font-size: .68rem;
  font-weight: 750;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pancake-message.staff .pancake-message-sender {
  color: #1d4ed8;
}
.pancake-message-badge {
  background: #e2e8f0;
  border-radius: 3px;
  color: #475569;
  font-size: .54rem;
  font-weight: 600;
  padding: 0 4px;
}
.pancake-message.staff .pancake-message-badge {
  background: #dbeafe;
  color: #1d4ed8;
}
.pancake-message-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px 8px;
  width: 100%;
}
.pancake-message-time {
  color: #64748b;
  font-size: .62rem;
  font-weight: 500;
  white-space: nowrap;
  margin-left: auto;
  align-self: flex-end;
  line-height: 1.2;
  padding-bottom: 1px;
}
.pancake-message.staff .pancake-message-time {
  color: #1d4ed8;
  opacity: .8;
}
.pancake-message-text {
  color: #0f172a;
  font-size: .82rem;
  line-height: 1.38;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1 1 auto;
}

/* Phân cách ngày hội thoại */
.pancake-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0 4px;
  position: relative;
  text-align: center;
}
.pancake-date-divider::before {
  background: #e2e8f0;
  content: "";
  height: 1px;
  left: 10%;
  position: absolute;
  right: 10%;
  top: 50%;
  z-index: 1;
}
.pancake-date-divider span {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #64748b;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 1px 10px;
  position: relative;
  z-index: 2;
}

/* Nút tải thêm tin cũ */
.pancake-load-more-wrap {
  margin: 2px 0 6px;
  text-align: center;
}
.pancake-load-more-btn {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 20px !important;
  color: #334155 !important;
  cursor: pointer !important;
  font-size: .72rem !important;
  font-weight: 600 !important;
  padding: 4px 14px !important;
  transition: all .15s ease !important;
}
.pancake-load-more-btn:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}
.pancake-message-attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0 4px;
}
.pancake-attachment {
  display: block;
}
.pancake-attachment img {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  cursor: pointer;
  display: block;
  max-height: 240px;
  max-width: min(100%, 300px);
  object-fit: cover;
  transition: opacity .15s ease;
}
.pancake-attachment img:hover {
  opacity: .92;
}
.pancake-sticker-wrap {
  display: inline-block;
  margin: 2px 0;
}
.pancake-sticker {
  display: block;
  max-height: 125px;
  max-width: 125px;
  object-fit: contain;
}
.pancake-link-card {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  margin: 2px 0;
  max-width: 100%;
  padding: 6px 9px;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.pancake-link-card:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.pancake-link-icon {
  flex-shrink: 0;
  font-size: 1.05rem;
}
.pancake-link-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pancake-link-title {
  color: #0284c7;
  display: block;
  font-size: .74rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pancake-link-url {
  color: #64748b;
  display: block;
  font-size: .62rem;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pancake-file-card {
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 600;
  gap: 6px;
  margin: 2px 0;
  padding: 5px 8px;
  text-decoration: none;
}
.pancake-file-card:hover {
  background: #e2e8f0;
}
.pancake-file-icon {
  font-size: .85rem;
}
.pancake-file-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pancake-file-tag {
  background: #f1f5f9;
  border-radius: 4px;
  color: #475569;
  display: inline-block;
  font-size: .7rem;
  margin: 2px 0;
  padding: 2px 6px;
}
.pancake-template-card {
  align-items: center;
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  border-radius: 6px;
  color: #475569;
  display: inline-flex;
  font-size: .72rem;
  gap: 6px;
  margin: 2px 0;
  padding: 4px 8px;
}
.pancake-video, .pancake-audio {
  border-radius: 8px;
  display: block;
  margin: 3px 0;
  max-width: 100%;
}
.pancake-send { align-items: start; border-top: 1px solid #e9eeea; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) auto; margin: 0; padding: 10px; }
.pancake-send-actions { align-self: center; align-items: stretch; display: flex; flex-direction: column; gap: 4px; width: 76px; }
.pancake-send-actions button { font-size: .68rem; min-height: 30px; padding: 6px 8px; }
.pancake-composer-tabs { border-bottom: 1px solid #e1e8e3; display: flex; gap: 4px; margin-top: 10px; padding: 0 10px; }
.pancake-composer-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; color: #718079; cursor: pointer; font-size: .74rem; font-weight: 800; padding: 8px 10px; }
.pancake-composer-tab.active { border-bottom-color: #70a92f; color: #365344; }
.pancake-suggestions { padding: 10px; }
.suggestions-head { align-items: center; display: flex; justify-content: space-between; margin-bottom: 8px; }
.suggestion-view-tabs { border-bottom: 1px solid #e1e8e3; display: flex; gap: 4px; margin: -2px 0 8px; overflow-x: auto; padding-bottom: 2px; }
.suggestion-view-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; color: #718079; cursor: pointer; font-size: .68rem; font-weight: 800; padding: 6px 8px; white-space: nowrap; }
.suggestion-view-tab.active { border-bottom-color: #70a92f; color: #365344; }
.suggestions-list { display: grid; gap: 8px; max-height: 300px; overflow-y: auto; }
.suggestion-card { background: #f7faf5; border: 1px solid #dce8d4; border-radius: 9px; display: grid; gap: 9px; padding: 9px 10px; text-align: left; }
.suggestion-card:hover { background: #edf5e6; border-color: #b8d49d; }
.suggestion-card-body { align-items: start; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) auto; }
.suggestion-card-copy { display: grid; gap: 3px; min-width: 0; }
.suggestion-card strong { color: #365344; font-size: .76rem; }
.suggestion-card span { color: #718079; font-size: .7rem; line-height: 1.35; }
.suggestion-card-copy > span:last-child { max-height: 6.75em; overflow-y: auto; padding-right: 4px; }
.suggestion-card .suggestion-code { color: #70a92f; font-size: .64rem; font-weight: 800; letter-spacing: .04em; }
.suggestion-thumbnail { align-items: center; background: #fff; border: 1px solid #dce8d4; border-radius: 8px; display: grid; gap: 3px; justify-items: center; padding: 4px; width: 92px; }
.suggestion-thumbnail img { border-radius: 6px; display: block; height: 82px; max-width: 82px; object-fit: contain; width: 82px; }
.suggestion-thumbnail small { color: #718079; font-size: .6rem; }
.suggestion-use-button { justify-self: start; min-height: 30px; padding: 0 10px; }
.suggestion-card-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; }
.suggestion-regenerate-button { min-height: 30px; padding: 0 10px; }
.pancake-suggestions-column .suggestion-card-actions { gap: 4px; }
.pancake-suggestions-column .suggestion-regenerate-button { font-size: .64rem; min-height: 26px; padding: 0 8px; }
.email-compose-field { display: grid; gap: 6px; margin-top: 12px; }
.email-compose-field input, .email-compose-field textarea { width: 100%; }
.email-compose-form { display: grid; gap: 4px; grid-column: 1 / -1; }
.email-compose-form .email-compose-field { grid-column: auto; }
.email-compose-form .primary-button { justify-self: start; margin-top: 6px; }
.pancake-send-fields { display: grid; gap: 7px; min-width: 0; }
.pancake-send textarea { font-size: .7rem; line-height: 1.35; min-height: 42px; resize: none; }
#campaignPancakeMessage { font-size: .72rem; line-height: 1.4; min-height: 360px; }
#pancakeMessage { height: 180px; min-height: 180px !important; }
.pancake-attachment-row { align-items: center; display: flex; gap: 8px; min-height: 30px; }
.pancake-image-preview { align-items: center; background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 8px; display: flex; gap: 8px; padding: 4px 8px 4px 4px; box-shadow: 0 1px 4px rgba(16, 185, 129, 0.12); }
.pancake-image-preview img { border-radius: 6px; height: 50px; width: 50px; object-fit: contain; background: #ffffff; border: 1px solid #bbf7d0; flex-shrink: 0; }
.pancake-image-preview span { color: #166534; font-size: .75rem; font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pancake-file-button { align-items: center; background: #edf4df; border: 1px solid #dbe8ca; border-radius: 7px; color: #55743d; cursor: pointer; display: inline-flex; font-size: .72rem; font-weight: 800; min-height: 32px; padding: 0 10px; }
.pancake-file-button:focus-within, .pancake-file-button:focus-visible { outline: 3px solid rgba(112, 169, 47, .3); outline-offset: 2px; }
.pancake-clear-image { font-size: .68rem; min-height: 30px; padding: 0 8px; }
.zalo-video-preview-wrap { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.zalo-video-card {
  position: relative;
  width: 240px;
  height: 135px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  border: 1.5px solid #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.zalo-video-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
}
.zalo-video-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.65) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  pointer-events: none;
}
.zalo-video-play-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  border: 2px solid #ffffff;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  pointer-events: none;
}
.zalo-video-play-btn svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
  margin-left: 2px;
}
.zalo-video-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.zalo-video-duration-badge {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  letter-spacing: 0.02em;
}
.zalo-video-size-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
}
.zalo-video-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.zalo-video-thumbnail-label {
  cursor: pointer;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.zalo-video-thumbnail-label:hover {
  background: #dbeafe;
}
@media (max-width: 590px) { .pancake-toolbar { grid-template-columns: 1fr; } .pancake-link-row, .pancake-send { grid-template-columns: 1fr; } .pancake-send-actions { width: 100%; } }
@media (max-width: 900px) { .pancake-chat-layout { grid-template-columns: 1fr; } .pancake-suggestions-column { position: static; } .pancake-suggestions-column .pancake-suggestions { max-height: 360px; } }


.display-settings-panel { max-width: 1600px; width: 100%; }

#displayProductsConfigEditor {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
}
#displayProductsSummaryPanel {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}
@media (max-width: 768px) {
  #displayProductsConfigEditor,
  #displayProductsSummaryPanel {
    grid-template-columns: 1fr;
  }
}

.ai-box-config-form { background: #fff; border: 1px solid #e1e8e3; border-radius: 12px; margin-top: 16px; padding: 16px; }
.lark-env-section { border-top: 1px solid #e1e8e3; margin-top: 24px; padding-top: 8px; }
.display-config-toolbar { align-items: end; display: flex; gap: 14px; justify-content: space-between; margin-bottom: 16px; }
.display-config-toolbar label { color: #65766c; display: grid; font-size: .72rem; font-weight: 800; gap: 6px; max-width: 320px; width: 100%; }
.display-config-toolbar select { background: #fff; }
.display-config-editor { display: grid; gap: 20px; grid-template-columns: minmax(280px, 1fr) minmax(340px, 1.3fr) minmax(340px, 1.3fr); }
.display-field-section { background: #fff; border: 1px solid #e1e8e3; border-radius: 12px; min-width: 0; padding: 18px 20px; }
.display-field-section-head { align-items: center; display: flex; justify-content: space-between; margin-bottom: 10px; }
.display-field-section-head .eyebrow { margin-bottom: 3px; }
.display-field-list { display: grid; gap: 6px; }
.display-field-row { align-items: center; background: #f8faf8; border: 1px solid #e7eee8; border-radius: 8px; display: flex; gap: 8px; justify-content: space-between; min-height: 46px; padding: 7px 9px; }
.display-field-row.selected { background: #f0f7e8; border-color: #d4e7c1; }
.display-field-row[draggable="true"] { cursor: grab; }
.display-field-row.dragging { cursor: grabbing; opacity: .45; }
.display-field-row.fixed { background: #f1f4f1; }
.display-field-row label { align-items: center; display: flex; gap: 9px; min-width: 0; }
.display-drag-handle { color: #87958d; cursor: grab; font-size: 1rem; letter-spacing: 0; line-height: 1; user-select: none; }
.display-field-row label > span { min-width: 0; }
.display-field-row strong, .display-field-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.display-field-row strong { color: #385246; font-size: .78rem; }
.display-field-row small { color: #87958d; font-size: .67rem; margin-top: 2px; }
.display-field-row input { min-height: auto; width: auto; }
.display-field-actions { display: flex; flex: 0 0 auto; gap: 4px; }
.display-move { border-radius: 7px; font-size: .8rem; height: 30px; padding: 0; width: 30px; }
.lead-extra { color: #718079; font-size: .73rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.display-settings-panel .config-dialog-actions { margin-top: 12px; }
.error-state, .message.error { color: #bd4237; }
.display-settings-panel .message { margin: 10px 0 0; }
@media (max-width: 900px) { .display-config-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 590px) { .display-config-toolbar { align-items: stretch; display: grid; } .display-config-toolbar label { max-width: none; } .display-config-editor { grid-template-columns: 1fr; } }
.pancake-config-dialog, .lark-config-dialog { max-width: min(640px, calc(100vw - 30px)); }
dialog#editPresetDialog.pancake-config-dialog {
  max-width: min(840px, calc(100vw - 30px));
  width: 840px;
}
.error-text { color: #a63f35; }
.success-text { color: #2f7651; }
.pancake-config-form { background: #fff; border: 1px solid #e1e8e3; border-radius: 15px; padding: 20px; }
.config-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.checkbox-label { align-items: center; display: flex; gap: 8px; }
.checkbox-label input { min-height: auto; width: auto; }
.field-hint { color: #718079; display: block; font-size: .7rem; margin-top: 4px; }
.report-metric-fieldset { border: 1px solid #d8ddda; margin: 0; padding: 12px; }
.report-metric-fieldset legend { color: #59655f; font-size: .72rem; font-weight: 800; padding: 0 5px; }
.report-metric-list { display: grid; gap: 9px 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 590px) { .report-metric-list { grid-template-columns: 1fr; } }
.optional-field input { background: #f7f9f7; }
.config-list { display: grid; gap: 10px; margin-top: 18px; }
.config-item { align-items: center; background: #fff; border: 1px solid #e1e8e3; border-radius: 12px; display: flex; gap: 12px; justify-content: space-between; padding: 14px; }
.config-item-main { align-items: center; display: flex; gap: 10px; min-width: 0; }
.config-item strong, .config-item small { display: block; }
.config-item small { color: #718079; font-size: .72rem; margin-top: 4px; }
.config-item > div { display: flex; gap: 7px; }
.config-item-actions { flex-wrap: wrap; justify-content: flex-end; }
.email-provider-cards { display: grid; gap: 10px; margin: 16px 0; }
.email-provider-card { align-items: stretch; flex-direction: column; }
.email-provider-card .config-item-main { align-items: flex-start; }
.email-provider-card .config-item-actions { justify-content: flex-start; }
.email-provider-card .provider-status { font-weight: 700; }
.email-provider-card .provider-status.active { color: #28754b; }
.email-provider-card .provider-status.inactive { color: #9a6a13; }
.danger-button { background: #fff0ed; border: 1px solid #f0c8c0; border-radius: 9px; color: #b14338; font-weight: 750; min-height: 40px; padding: 9px 14px; }
.danger-button:hover { background: #ffe3de; }
.pancake-platform-icon { align-items: center; border-radius: 8px; color: #fff; display: inline-flex; flex: 0 0 auto; font-family: Arial, sans-serif; font-size: .95rem; font-weight: 900; height: 27px; justify-content: center; line-height: 1; width: 27px; }
.pancake-platform-icon.facebook { background: #1877f2; }
.pancake-platform-icon.zalo { background: #0068ff; font-size: .78rem; }
.pancake-platform-icon.email { background: #d87932; font-size: .82rem; }
.pancake-platform-icon.phone { background: #2f7eae; font-size: .72rem; }
.pancake-linked-button .pancake-platform-icon, .pancake-thread-head .pancake-platform-icon { height: 20px; margin-right: 4px; vertical-align: -4px; width: 20px; }
.email-channel-card { align-items: start; background: #f7faf5; border: 1px solid #dce8d4; border-radius: 12px; display: grid; gap: 13px; grid-template-columns: auto minmax(0, 1fr); padding: 18px; }
.email-channel-icon { align-items: center; background: #d87932; border-radius: 10px; color: #fff; display: flex; flex: 0 0 auto; font-size: 1.25rem; font-weight: 900; height: 42px; justify-content: center; width: 42px; }
.email-channel-card .eyebrow { margin-bottom: 4px; }
.email-compose-field, .email-open-client { grid-column: 1 / -1; }
.email-channel-address { color: #315b43; font-size: .9rem; font-weight: 800; overflow-wrap: anywhere; }
.email-channel-contact { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.phone-call-button { align-items: center; background: #2f7eae; border-radius: 50%; color: #fff; display: inline-flex; font-size: .9rem; height: 28px; justify-content: center; text-decoration: none; width: 28px; }
.phone-call-button:hover, .phone-call-button:focus-visible { background: #216489; }
.conversation-phone-button { flex: 0 0 auto; margin-left: 2px; }
.email-channel-status { font-size: .72rem; margin: 5px 0 0; }
.email-channel-status.allowed { color: #3d7438; }
.email-channel-status.blocked { color: #a8661c; }
.muted { color: #89968f; font-size: .76rem; }
.error-state, .message.error { color: #bd4237; }

/* Giao diện xanh dương đồng bộ */
:root { color: #17344f; background: #f5f9fc; }
.auth-shell { background: radial-gradient(circle at 75% 15%, #dff2ff, transparent 35%), #f5f9fc; }
.login-card, .chart-card, .detail-panel, .email-history-section, .pancake-suggestions-column, .ai-box-config-form, .ai-box-playground, .display-field-section, .pancake-config-form, .config-item, .lark-dashboard-embed { border-color: #dbe7ef; }
.login-card { box-shadow: 0 24px 80px #123b6614; }
.brand-mark, .sidebar { background: #123b66; }
.brand-mark { color: #a9ddff; }
.eyebrow { color: #6d8799; }
.intro { color: #667f93; }
label { color: #4d687d; }
input, select, textarea { background: #f7fbfe; border-color: #d9e6ef; color: #17344f; }
input:focus, select:focus, textarea:focus { border-color: #55a7d6; box-shadow: 0 0 0 3px #dff2ff; }
.password-input button { color: #55758c; }
.primary-button { background: #123b66; }
.primary-button:hover { background: #1f5c91; }
.secondary-button, .logout-button { background: #eaf2f7; color: #2d5675; }
.message.success { color: #2675a8; }
.nav-item { color: #aac7d8; }
.nav-item:hover, .nav-item.active { background: #1f5c91; }
.sidebar .nav-group-title, .sidebar .nav-group-toggle-arrow { color: #82a8c2; }
.nav-icon { color: #a9ddff; }
.avatar { background: #a9ddff; color: #123b66; }
.signed-user small { color: #aac7d8; }
.logout-button { background: #ffffff12; color: #d8ebf7; }
.live-dot { color: #52758e; }
.live-dot::before { background: #4aa3d8; }
.stat-card { border-color: #dbe7ef; }
.stat-card.accent { background: #dff2ff; border-color: #cbe8f7; }
.stat-label { color: #61798d; }
.stat-card strong { color: #123b66; }
.stat-card small { color: #7891a2; }
.stat-card.success { background: #eaf6fc; border-color: #cce6f5; }
.stat-card.success strong { color: #2e7ea9; }
.lark-dashboard-embed { box-shadow: 0 10px 28px #123b6608; }
.dashboard-period-label { color: #2a587a; }
.dashboard-periods { background: #eaf3f8; }
.dashboard-period { color: #6a8496; }
.dashboard-period:hover, .dashboard-period.active { color: #123b66; box-shadow: 0 2px 8px #123b6610; }
.chart-heading h2 { color: #203e59; }
.chart-note, .chart-empty, .chart-legend { color: #91a4b1; }
.legend-dot.leads, .trend-line.leads { background: #4aa3d8; stroke: #4aa3d8; }
.legend-dot.followups, .trend-line.followups { background: #123b66; stroke: #123b66; }
.trend-svg line { stroke: #e7f0f5; }
.trend-svg text { fill: #91a5b3; }
.bar-label strong { color: #315a78; }
.bar-label span { color: #899eab; }
.bar-track, .funnel-track { background: #e9f1f6; }
.bar-track rect { fill: #3f8fc2; }
.funnel-level { color: #4c6f8a; }
.funnel-track rect { fill: #3b82b5; }
.funnel-row strong { color: #2b5776; }
.sales-table th { color: #91a4b1; }
.sales-table td { border-color: #e8f0f5; color: #4e718b; }
.sales-table td:first-child { color: #244762; }
.sales-table td:last-child { color: #2d82b8; }
.campaign-count { color: #2f7eae; }
.campaign-tabs { border-color: #d9e6ef; }
.campaign-tab, .campaign-composer-tab, .suggestion-view-tab { color: #6d8799; }
.campaign-tab:hover, .campaign-tab.active { border-bottom-color: #4aa3d8; color: #123b66; }
.campaign-tab-index { background: #eaf2f7; color: #6b8596; }
.campaign-tab.active .campaign-tab-index { background: #a9ddff; color: #123b66; }
.campaign-purpose { border-color: #dbe7ef; }
.campaign-description-trigger { color: #6d8799; }
.campaign-description-trigger:hover { color: #123b66; }
.campaign-description-trigger:focus-visible { outline-color: #dff2ff; }
.campaign-description { color: #3e607a; }
.campaign-description-form input { border-color: #68b5df; }
.email-history-section-head strong { color: #203e59; }
.campaign-composer-tab:hover, .campaign-composer-tab.active, .suggestion-view-tab.active { border-bottom-color: #3f96c7; color: #315f7d; }
.campaign-image-preview, .email-history-row { background: #f6fbfe; border-color: #d7eaf4; }
.campaign-image-preview span, .email-history-row small, .email-history-row div:nth-child(2) span { color: #52748c; }
.email-history-row strong { color: #123b66; }
.email-history-status > :first-child { background: #e7f4fb; color: #3d7497; }
.email-history-actions button { border-color: #cfe3ee; color: #3d7497; }
.email-history-actions button:hover { background: #e7f4fb; }
.result-count, .muted { color: #899eab; }
.period-tabs { border-color: #d9e6ef; }
.period-tab { color: #6d8799; }
.period-tab:hover, .period-tab.active { border-bottom-color: #4aa3d8; color: #123b66; }
.search-field, .lead-card { border-color: #dbe7ef; }
.search-field span { color: #718da0; }
.lead-table-head { color: #899eab; }
.lead-card:hover, .lead-card.selected { border-color: #68b5df; box-shadow: 0 8px 22px #123b660d; }
.lead-avatar { background: #e7f4fb; color: #3d7497; }
.lead-name small, .lead-sale, .lead-date { color: #8198a8; }
.level-pill { background: #edf4f8; color: #52748c; }
.empty-state, .empty-detail, .loading-state { color: #899eab; }
.loading-spinner { border-color: #d7eaf4; border-top-color: #3f8fc2; }
.detail-view-tabs { border-color: #dbe7ef; }
.detail-view-tab { color: #6d8799; }
.detail-view-tab:hover, .detail-view-tab.active { border-bottom-color: #4aa3d8; color: #123b66; }
.detail-heading p { color: #718da0; }
.care-button { background: #a9ddff; color: #123b66; }
.care-button:hover { background: #8bd0f5; }
.care-button:disabled { background: #edf3f7; color: #7c91a0; }
.detail-tag { background: #edf4f8; color: #5b7489; }
.detail-section { border-color: #e7eff4; }
.detail-section h3 { color: #607d90; }
.detail-section p { color: #38566f; }
.fact span { color: #899eac; }
.timeline-item { border-color: #a9ddff; }
.timeline-item::before { background: #68b5df; }
.empty-icon { color: #a9d8f2; }
.empty-detail h3 { color: #3f6079; }
dialog::backdrop { background: #102a4080; }
.care-form { background: #fff; }
.icon-button { background: #edf3f7; color: #526f85; }
.dialog-lead { background: #e8f5fb; color: #3d7497; }
.lead-channel-hint { background: #f6fbfe; border-color: #d7eaf4; color: #52748c; }
.lead-channel-hint strong { color: #315f7d; }
.pancake-toolbar select, .pancake-toolbar input, .pancake-link-row select, .optional-field input { background: #f7fbfe; }
.pancake-platform-tab { background: #edf4f8; color: #5b7890; }
.pancake-platform-tab.active { background: #123b66; border-color: #123b66; }
.pancake-open-tab:not(:disabled), .pancake-linked-button, .pancake-file-button { background: #e7f4fb; border-color: #d1e8f4; color: #3d7497; }
.pancake-link-status, .pancake-attachment-label { color: #52748c; }
.pancake-linked-button.active { background: #123b66; color: #fff; }
.pancake-thread { border-color: #dbe7ef; }
.pancake-thread-head, .pancake-suggestions-column-head { background: #eef7fb; border-color: #dbe7ef; }
.pancake-thread-head strong, .pancake-suggestions-column-head strong { color: #315f7d; }
.pancake-message { background: #edf4f8; }
.pancake-message.staff { background: #dceffc; }
.pancake-message small, .pancake-message.incoming small { color: #52758b; }
.pancake-message.outgoing small { color: #3d7497; }
.pancake-message p { color: #31556d; }
.pancake-send { border-color: #e7eff4; }
.pancake-composer-tab, .suggestion-view-tab { color: #6d8799; }
.suggestion-card { background: #f6fbfe; border-color: #d7eaf4; }
.suggestion-card:hover { background: #e7f4fb; border-color: #a9d8f2; }
.suggestion-card strong { color: #315f7d; }
.suggestion-card span, .suggestion-thumbnail small { color: #6d8799; }
.suggestion-card .suggestion-code { color: #3f96c7; }
.suggestion-thumbnail, .pancake-image-preview { border-color: #d7eaf4; background: #fff; }
.pancake-image-preview span { color: #52748c; }
.pancake-file-button:focus-within, .pancake-file-button:focus-visible { outline-color: rgba(63, 150, 199, .3); }
.email-channel-card { background: #f6fbfe; border-color: #d7eaf4; }
.email-channel-address, .email-channel-status.allowed { color: #2f7eae; }
.ai-box-playground h3 { color: #315a78; }
.ai-box-output { background: #f0f7fb; border-color: #dbe7ef; color: #31556d; }
.display-config-toolbar label { color: #607d90; }
.display-field-row { background: #f7fbfd; border-color: #e1edf4; }
.display-field-row.selected { background: #e6f4fb; border-color: #c8e5f2; }
.display-field-row.fixed { background: #edf4f8; }
.display-field-row strong { color: #315a78; }
.display-field-row small, .field-hint, .config-item small { color: #6d8799; }
.lead-extra { color: #6d8799; }
.success-text { color: #2b78aa; }

/* Tinh chỉnh theo bảng màu Lark */
:root { color: #1f2329; background: #f5f8ff; }
.auth-shell { background: radial-gradient(circle at 75% 15%, #e8f0ff, transparent 35%), #f5f8ff; }
.brand-mark, .sidebar { background: #0e3b8e; }
.brand-mark { color: #bfd4ff; }
.primary-button { background: #1456f0; }
.primary-button:hover { background: #0f45c7; }
.secondary-button, .logout-button { background: #eaf0ff; color: #1b4eb8; }
.nav-item { color: #c3d4ff; }
.nav-item:hover, .nav-item.active { background: #336df4; color: #fff; }
.nav-icon { color: #bfd4ff; }
.avatar { background: #bfd4ff; color: #0e3b8e; }
.signed-user small { color: #c3d4ff; }
.logout-button { background: #ffffff1c; color: #fff; }
.live-dot { color: #4e6685; }
.live-dot::before { background: #4e83fd; }
.login-card, .chart-card, .detail-panel, .email-history-section, .pancake-suggestions-column, .ai-box-config-form, .ai-box-playground, .display-field-section, .pancake-config-form, .config-item, .lark-dashboard-embed, .stat-card, .lead-card, .search-field { border-color: #d8e2f2; }
.stat-card.accent { background: #e3edff; border-color: #c8d9ff; }
.stat-card strong, .email-history-row strong { color: #0e3b8e; }
.stat-card.success { background: #e8f0ff; border-color: #c8d9ff; }
.stat-card.success strong { color: #1456f0; }
.dashboard-period-label { color: #174aaf; }
.dashboard-periods, .campaign-tab-index { background: #eaf0ff; }
.dashboard-period:hover, .dashboard-period.active { color: #0e3b8e; }
.chart-heading h2, .email-history-section-head strong { color: #1f2329; }
.legend-dot.leads, .trend-line.leads { background: #4e83fd; stroke: #4e83fd; }
.legend-dot.followups, .trend-line.followups { background: #1456f0; stroke: #1456f0; }
.bar-track rect, .funnel-track rect { fill: #336df4; }
.campaign-tab:hover, .campaign-tab.active, .period-tab:hover, .period-tab.active, .detail-view-tab:hover, .detail-view-tab.active { border-bottom-color: #4e83fd; color: #1456f0; }
.campaign-tab.active .campaign-tab-index { background: #bfd4ff; color: #0e3b8e; }
.campaign-description-trigger:hover { color: #1456f0; }
.lead-card:hover, .lead-card.selected { border-color: #4e83fd; box-shadow: 0 8px 22px #1456f01a; }
.lead-avatar { background: #e8f0ff; color: #174aaf; }
.level-pill, .detail-tag { background: #edf3ff; color: #2859ad; }
.loading-spinner { border-color: #d7e3fb; border-top-color: #336df4; }
.care-button { background: #4e83fd; color: #fff; }
.care-button:hover { background: #1456f0; }
.care-button:disabled { background: #edf1f7; color: #7a8494; }
.timeline-item { border-color: #bfd4ff; }
.timeline-item::before { background: #4e83fd; }
.dialog-lead, .lead-channel-hint { background: #eaf0ff; color: #2859ad; }
.pancake-platform-tab.active, .pancake-linked-button.active { background: #1456f0; border-color: #1456f0; }
.pancake-open-tab:not(:disabled), .pancake-linked-button, .pancake-file-button { background: #e8f0ff; border-color: #c8d9ff; color: #2859ad; }
.pancake-thread-head, .pancake-suggestions-column-head { background: #edf3ff; }
.pancake-message.staff { background: #e0ebff; }
.suggestion-card { background: #f7faff; border-color: #cddcff; }
.suggestion-card:hover { background: #e8f0ff; border-color: #9ebcff; }
.suggestion-card strong, .suggestion-card .suggestion-code { color: #1456f0; }
.suggestion-card .suggestion-code { color: #336df4; }
.display-field-row.selected { background: #e8f0ff; border-color: #c8d9ff; }
.success-text, .message.success, .email-channel-address, .email-channel-status.allowed { color: #1456f0; }

/* Bảng màu Facebook: sáng, trung tính, xanh nổi bật */
:root { color: #1c1e21; background: #f0f2f5; }
.auth-shell { background: radial-gradient(circle at 75% 15%, #e7f3ff, transparent 35%), #f0f2f5; }
.login-card, .chart-card, .detail-panel, .email-history-section, .pancake-suggestions-column, .ai-box-config-form, .ai-box-playground, .display-field-section, .pancake-config-form, .config-item, .lark-dashboard-embed, .stat-card, .lead-card, .search-field { border-color: #dddfe2; }
.login-card { box-shadow: 0 24px 80px #1c1e2114; }
.brand-mark, .sidebar { background: #145dbf; }
.brand-mark { color: #e7f3ff; }
.eyebrow { color: #65676b; }
.intro { color: #65676b; }
label { color: #4b4f56; }
input, select, textarea { background: #f5f6f7; border-color: #ccd0d5; color: #1c1e21; }
input:focus, select:focus, textarea:focus { background: #fff; border-color: #1877f2; box-shadow: 0 0 0 3px #e7f3ff; }
.password-input button { color: #385898; }
.primary-button { background: #1877f2; }
.primary-button:hover { background: #166fe5; }
.secondary-button, .logout-button { background: #e4e6eb; color: #1c1e21; }
.message.success, .success-text { color: #1877f2; }
.nav-item { color: #dbeaff; }
.nav-item:hover, .nav-item.active { background: #1877f2; color: #fff; }
.nav-icon { color: #e7f3ff; }
.avatar { background: #e7f3ff; color: #145dbf; }
.signed-user small { color: #dbeaff; }
.logout-button { background: #ffffff20; color: #fff; }
.workspace { background: #f0f2f5; }
.live-dot { color: #65676b; }
.live-dot::before { background: #1877f2; }
.stat-card.accent { background: #e7f3ff; border-color: #cfe3ff; }
.stat-label { color: #65676b; }
.stat-card strong { color: #1c1e21; }
.stat-card small { color: #65676b; }
.stat-card.success { background: #e7f3ff; border-color: #cfe3ff; }
.stat-card.success strong { color: #1877f2; }
.dashboard-period-label { color: #1c1e21; }
.dashboard-periods, .campaign-tab-index { background: #e4e6eb; }
.dashboard-period { color: #65676b; }
.dashboard-period:hover, .dashboard-period.active { color: #1877f2; box-shadow: 0 2px 8px #1c1e2112; }
.chart-heading h2, .email-history-section-head strong { color: #1c1e21; }
.chart-note, .chart-empty, .chart-legend { color: #65676b; }
.legend-dot.leads, .trend-line.leads { background: #42b72a; stroke: #42b72a; }
.legend-dot.followups, .trend-line.followups { background: #1877f2; stroke: #1877f2; }
.trend-svg line { stroke: #e4e6eb; }
.trend-svg text { fill: #65676b; }
.bar-track, .funnel-track { background: #e4e6eb; }
.bar-track rect, .funnel-track rect { fill: #1877f2; }
.bar-label strong, .funnel-level { color: #1c1e21; }
.bar-label span, .chart-note, .sales-table th { color: #65676b; }
.funnel-row strong, .sales-table td:first-child { color: #1c1e21; }
.sales-table td { border-color: #e4e6eb; color: #65676b; }
.sales-table td:last-child, .campaign-count { color: #1877f2; }
.campaign-tabs, .period-tabs, .detail-view-tabs { border-color: #ccd0d5; }
.campaign-tab, .campaign-composer-tab, .suggestion-view-tab, .period-tab, .detail-view-tab { color: #65676b; }
.campaign-tab:hover, .campaign-tab.active, .period-tab:hover, .period-tab.active, .detail-view-tab:hover, .detail-view-tab.active { border-bottom-color: #1877f2; color: #1877f2; }
.campaign-tab-index { color: #65676b; }
.campaign-tab.active .campaign-tab-index { background: #b3d7ff; color: #145dbf; }
.campaign-purpose { border-color: #dddfe2; }
.campaign-description-trigger { color: #65676b; }
.campaign-description-trigger:hover { color: #1877f2; }
.campaign-description { color: #4b4f56; }
.campaign-description-form input { border-bottom-color: #1877f2; }
.campaign-image-preview, .email-history-row { background: #f5f6f7; border-color: #dddfe2; }
.campaign-image-preview span, .email-history-row small, .email-history-row div:nth-child(2) span { color: #65676b; }
.email-history-row strong { color: #1c1e21; }
.email-history-status > :first-child { background: #e7f3ff; color: #385898; }
.email-history-actions button { border-color: #ccd0d5; color: #385898; }
.email-history-actions button:hover { background: #e7f3ff; }
.result-count, .muted, .lead-table-head { color: #65676b; }
.search-field span { color: #65676b; }
.lead-card { background: #fff; }
.lead-card:hover, .lead-card.selected { border-color: #1877f2; box-shadow: 0 8px 22px #1c1e2114; }
.lead-avatar { background: #e7f3ff; color: #385898; }
.lead-name small, .lead-sale, .lead-date { color: #65676b; }
.level-pill, .detail-tag { background: #e4e6eb; color: #4b4f56; }
.empty-state, .empty-detail, .loading-state { color: #65676b; }
.loading-spinner { border-color: #d8dadf; border-top-color: #1877f2; }
.detail-heading p { color: #65676b; }
.care-button { background: #1877f2; color: #fff; }
.care-button:hover { background: #166fe5; }
.care-button:disabled { background: #e4e6eb; color: #8a8d91; }
.detail-section { border-color: #e4e6eb; }
.detail-section h3 { color: #65676b; }
.detail-section p { color: #4b4f56; }
.fact span, .timeline-item small { color: #65676b; }
.timeline-item { border-color: #b3d7ff; }
.timeline-item::before { background: #1877f2; }
.empty-icon { color: #b3d7ff; }
.empty-detail h3 { color: #4b4f56; }
dialog::backdrop { background: #1c1e2180; }
.icon-button { background: #e4e6eb; color: #4b4f56; }
.dialog-lead, .lead-channel-hint { background: #e7f3ff; color: #385898; }
.lead-channel-hint { border-color: #cfe3ff; }
.pancake-toolbar select, .pancake-toolbar input, .pancake-link-row select, .optional-field input { background: #f5f6f7; }
.pancake-platform-tab { background: #e4e6eb; color: #4b4f56; }
.pancake-platform-tab.active, .pancake-linked-button.active { background: #1877f2; border-color: #1877f2; }
.pancake-open-tab:not(:disabled), .pancake-linked-button, .pancake-file-button { background: #e7f3ff; border-color: #cfe3ff; color: #385898; }
.pancake-thread { border-color: #dddfe2; }
.pancake-thread-head, .pancake-suggestions-column-head { background: #f5f6f7; border-color: #dddfe2; }
.pancake-thread-head strong, .pancake-suggestions-column-head strong { color: #1c1e21; }
.pancake-message { background: #e4e6eb; }
.pancake-message.staff { background: #dbeaff; }
.pancake-message p { color: #1c1e21; }
.suggestion-card { background: #f5f6f7; border-color: #dddfe2; }
.suggestion-card:hover { background: #e7f3ff; border-color: #b3d7ff; }
.suggestion-card strong { color: #1c1e21; }
.suggestion-card span, .suggestion-thumbnail small { color: #65676b; }
.suggestion-card .suggestion-code { color: #1877f2; }
.suggestion-thumbnail, .pancake-image-preview { border-color: #dddfe2; }
.pancake-file-button:focus-within, .pancake-file-button:focus-visible { outline-color: rgba(24, 119, 242, .3); }
.email-channel-card { background: #f5f6f7; border-color: #dddfe2; }
.email-channel-address, .email-channel-status.allowed { color: #1877f2; }
.ai-box-output { background: #f5f6f7; border-color: #dddfe2; color: #1c1e21; }
.display-config-toolbar label { color: #65676b; }
.display-field-row { background: #f5f6f7; border-color: #e4e6eb; }
.display-field-row.selected { background: #e7f3ff; border-color: #cfe3ff; }
.display-field-row.fixed { background: #e4e6eb; }
.display-field-row strong { color: #1c1e21; }
.display-field-row small, .field-hint, .config-item small, .lead-extra { color: #65676b; }

/* Sidebar tối, chữ trắng */
.brand-mark, .sidebar { background: #08244a; color: #fff; }
.side-brand, .side-brand span, .sidebar .nav-item, .sidebar .signed-user, .sidebar .signed-user strong, .sidebar .signed-user small, .sidebar .logout-button { color: #fff; }
.sidebar .nav-group-header { color: #fff; }
.sidebar .nav-group-title, .sidebar .nav-group-toggle-arrow { color: #8eb9eb; }
.sidebar .nav-item { background: transparent; }
.sidebar .nav-item:hover { background: #123d73; color: #fff; }
.sidebar .nav-item.active { background: #1877f2; color: #fff; }
.sidebar .nav-icon { color: #fff; }
.sidebar .signed-user small { color: #e0ebff; }
.sidebar .avatar { background: #fff; color: #08244a; }
.sidebar .logout-button { background: #123d73; color: #fff; }
.sidebar .logout-button:hover { background: #1877f2; }

/* Hội thoại: khu vực tìm và gắn tối giản */
.pancake-platform-tabs { align-items: center; gap: 4px; margin-bottom: 6px; }
.pancake-platform-tab { border-radius: 7px; font-size: .68rem; gap: 4px; min-height: 32px; padding: 5px 8px; }
.pancake-platform-tab .pancake-platform-icon { height: 17px; width: 17px; }
.pancake-open-tab { display: none !important; margin-left: auto; }
.pancake-link-status { align-items: center; font-size: .66rem; gap: 4px; line-height: 1.35; margin: 3px 0 6px; }
.pancake-link-status .pancake-platform-icon { height: 16px; width: 16px; }
.pancake-toolbar, .pancake-link-row { gap: 5px; margin-bottom: 6px; }
.pancake-toolbar { grid-template-columns: minmax(120px, .9fr) minmax(150px, 1.4fr) auto; }
.pancake-link-row { grid-template-columns: minmax(0, 1fr) auto; }
.pancake-toolbar select, .pancake-toolbar input, .pancake-link-row select { font-size: .7rem; min-height: 35px; padding: 7px 9px; }
.pancake-toolbar .secondary-button, .pancake-link-row .secondary-button { min-height: 35px; padding: 7px 10px; }
.pancake-linked { align-items: center; background: #f5f6f7; border: 1px solid #dddfe2; border-radius: 7px; gap: 5px; margin: 5px 0 7px; padding: 4px; }
.pancake-linked-button { flex: 1 1 auto; min-width: 0; overflow: hidden; padding: 6px 8px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.pancake-linked > .secondary-button { min-height: 30px; padding: 5px 8px; }
.pancake-connection-error { font-size: .66rem; margin: 4px 0; }
.pancake-toolbar select, .pancake-link-row select { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 590px) {
  .pancake-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .pancake-toolbar select { grid-column: 1 / -1; }
}

/* Danh sách lead: mật độ gần với bảng Lark */
#leadWorkspace .section-title { margin-bottom: 12px; }
#leadWorkspace .section-title h2 { font-size: 1.08rem; letter-spacing: -.035em; }
#leadWorkspace .section-title .eyebrow { font-size: .6rem; margin-bottom: 4px; }
#leadWorkspace .result-count { font-size: .68rem; }
#leadWorkspace .lead-list { gap: 4px; }
#leadWorkspace .lead-table-head,
#leadWorkspace .lead-card { gap: 8px; min-width: 0; }
#leadWorkspace .lead-table-head { font-size: .6rem; letter-spacing: .04em; padding: 0 10px 5px; }
#leadWorkspace .lead-card { border-radius: 7px; min-height: 44px; padding: 6px 10px; }
#leadWorkspace .lead-card:hover,
#leadWorkspace .lead-card.selected { transform: none; }
#leadWorkspace .lead-name { gap: 8px; min-width: 0; }
#leadWorkspace .lead-avatar { border-radius: 7px; font-size: .64rem; height: 30px; width: 30px; }
#leadWorkspace .lead-name > div,
#leadWorkspace .lead-sale,
#leadWorkspace .lead-level,
#leadWorkspace .lead-extra { min-width: 0; }
#leadWorkspace .lead-name strong { font-size: .78rem; line-height: 1.2; overflow: hidden; overflow-wrap: normal; text-overflow: ellipsis; white-space: nowrap; }
#leadWorkspace .lead-name small,
#leadWorkspace .lead-sale,
#leadWorkspace .lead-date,
#leadWorkspace .lead-extra { font-size: .64rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#leadWorkspace .level-pill { font-size: .64rem; padding: 4px 7px; }

/* Giao diện tinh giản, gọn gàng cho toàn bộ các tab (Ẩn tiêu đề đen góc trái trên cùng) */
.topbar {
 align-items: center;
 display: flex;
  justify-content: space-between !important;
  width: 100% !important;
  gap: 10px;
  margin-bottom: 12px !important;
  min-height: auto !important;
}
.topbar h1,
#pageTitle,
#pageEyebrow {
  display: none !important;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-left:empty {
  display: none !important;
}
/* Khi ở Follow Up, ẩn topbar hoàn toàn để đẩy giao diện lên sát trên */
#campaignPanel:not([hidden]) ~ .topbar,
.workspace:has(#campaignPanel:not([hidden])) .topbar {
  display: none !important;
  margin-bottom: 0 !important;
}
.workspace:has(#campaignPanel:not([hidden])) {
  padding-top: 14px !important;
}
#campaignPanel {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
#campaignPanel .followup-nav-tabs {
  margin-top: 0 !important;
  margin-bottom: 10px !important;
}
#campaignPanel .campaign-views-hub {
  padding-top: 18px !important;
}
#campaignPanel .campaign-hub-header {
  margin-bottom: 18px !important;
}
.topbar .topbar-actions,
.topbar.topbar-compact .topbar-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: auto !important;
  gap: 8px !important;
  margin-left: auto !important;
}
#leadListRefreshBtn {
  margin-left: 0 !important;
}

#leadWorkspace #leadSectionTitle,
#leadWorkspace #leadSectionEyebrow {
  display: none !important;
}
#leadWorkspace .section-title {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 8px !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}
#leadWorkspace .lead-column {
  padding-top: 10px !important;
}
.lead-actions-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 10px !important;
  width: 100% !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
}
.lead-actions-left {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
  flex-shrink: 0 !important;
}
#leadWorkspace #addLeadButton {
  background: linear-gradient(180deg, #86efac 0%, #4ade80 100%) !important;
  color: #052e16 !important;
  border: 1px solid #4ade80 !important;
  border-radius: 999px !important;
  font-size: 0.78rem !important;
  font-weight: 750 !important;
  letter-spacing: 0.2px !important;
  text-transform: uppercase !important;
  padding: 0 14px !important;
  min-height: 32px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  box-shadow: 0 2px 4px rgba(74, 222, 128, 0.3) !important;
  transition: all 0.15s ease !important;
}
#leadWorkspace #addLeadButton:hover {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%) !important;
  box-shadow: 0 3px 6px rgba(34, 197, 94, 0.4) !important;
}
#leadWorkspace #topCareButton {
  background: linear-gradient(180deg, #86efac 0%, #4ade80 100%) !important;
  color: #052e16 !important;
  border: 1px solid #4ade80 !important;
  border-radius: 999px !important;
  font-size: 0.78rem !important;
  font-weight: 750 !important;
  letter-spacing: 0.2px !important;
  text-transform: uppercase !important;
  padding: 0 14px !important;
  min-height: 32px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  box-shadow: 0 2px 4px rgba(74, 222, 128, 0.3) !important;
  transition: all 0.15s ease !important;
}
#leadWorkspace #topCareButton:hover {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%) !important;
  box-shadow: 0 3px 6px rgba(34, 197, 94, 0.4) !important;
}
#leadWorkspace #topCareButton.care-button-active {
  background: linear-gradient(180deg, #15803d 0%, #166534 100%) !important;
  color: #ffffff !important;
  border-color: #14532d !important;
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.4) !important;
}
#leadWorkspace #btnAutoMatchZaloBatch {
  background: #f0f9ff !important;
  color: #0284c7 !important;
  border: 1px solid #bae6fd !important;
  border-radius: 999px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  padding: 0 9px !important;
  min-height: 26px !important;
  height: 26px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: all 0.15s ease !important;
}
#leadWorkspace #btnAutoMatchZaloBatch:hover {
  background: #e0f2fe !important;
  border-color: #7dd3fc !important;
  color: #0369a1 !important;
}
#leadWorkspace #btnOpenLeadConfigModal {
  background: #f8fafc !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 999px !important;
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.88rem !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}
#leadWorkspace #btnOpenLeadConfigModal:not([hidden]) {
  display: inline-flex !important;
}
#leadWorkspace #btnOpenLeadConfigModal[hidden] {
  display: none !important;
}
#btnOpenExpenseEntryConfig[hidden] {
  display: none !important;
}
#btnConnectExpenseSheetPrompt[hidden] {
  display: none !important;
}
#leadWorkspace #btnOpenLeadConfigModal:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}
#leadWorkspace #toggleDetailPanelBtn {
  background: #f0fdf4 !important;
  color: #16a34a !important;
  border: 1px solid #bbf7d0 !important;
  border-radius: 999px !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}
#leadWorkspace #toggleDetailPanelBtn:hover {
  background: #dcfce7 !important;
  border-color: #86efac !important;
}
.lead-scope-tabs,
#leadWorkspace .lead-scope-tabs {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
}
.lead-scope-tabs[hidden],
#leadWorkspace .lead-scope-tabs[hidden] {
  display: none !important;
}
#leadWorkspace .section-title-actions {
 display: flex !important;
 align-items: center !important;
 width: auto !important;
 justify-content: flex-end !important;
 margin-left: auto !important;
}
.lead-scope-tab,
#leadWorkspace .lead-scope-tab {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  color: #475569 !important;
  font-size: 0.83rem !important;
  font-weight: 650 !important;
  padding: 0 14px !important;
  min-height: 34px !important;
  height: 34px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  outline: none !important;
  user-select: none !important;
  line-height: 1.2 !important;
}
.lead-scope-tab:hover,
#leadWorkspace .lead-scope-tab:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  color: #1e293b !important;
}
.lead-scope-tab.active,
#leadWorkspace .lead-scope-tab.active {
  background: #2563eb !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25) !important;
}
.lead-scope-tab.active:hover,
#leadWorkspace .lead-scope-tab.active:hover {
  background: #1d4ed8 !important;
  border-color: #1e40af !important;
  color: #ffffff !important;
}
.lead-scope-icon,
#leadWorkspace .lead-scope-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 20px !important;
  height: 20px !important;
  border-radius: 6px !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  background: #e2e8f0 !important;
  color: #475569 !important;
}
.lead-scope-tab:hover .lead-scope-icon,
#leadWorkspace .lead-scope-tab:hover .lead-scope-icon {
  background: #cbd5e1 !important;
  color: #0f172a !important;
}
.lead-scope-tab.active .lead-scope-icon,
#leadWorkspace .lead-scope-tab.active .lead-scope-icon {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
}
.lead-scope-tab .campaign-tab-badge,
.lead-scope-tab .lead-scope-badge,
#leadWorkspace .lead-scope-tab .campaign-tab-badge,
#leadWorkspace .lead-scope-tab .lead-scope-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 19px !important;
  height: 19px !important;
  padding: 0 6px !important;
  border-radius: 999px !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  background: #ef4444 !important;
  color: #ffffff !important;
  margin-left: 4px !important;
}
.lead-scope-tab.active .campaign-tab-badge,
.lead-scope-tab.active .lead-scope-badge,
#leadWorkspace .lead-scope-tab.active .campaign-tab-badge,
#leadWorkspace .lead-scope-tab.active .lead-scope-badge {
  background: #ffffff !important;
  color: #2563eb !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) !important;
}
#leadWorkspace .result-count {
  margin-right: auto !important;
}
#leadWorkspace .result-count {
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  color: #475569 !important;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  padding: 2px 8px !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
}
#leadWorkspace .open-lark-btn,
#leadWorkspace .panel-toggle-btn {
  font-size: 0.74rem !important;
  font-weight: 650 !important;
  padding: 4px 10px !important;
  border-radius: 7px !important;
  min-height: 28px !important;
  transition: all 0.15s ease !important;
}
#leadWorkspace .open-lark-btn {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}
#leadWorkspace .open-lark-btn:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}
#leadWorkspace .panel-toggle-btn {
  background: #f0fdf4 !important;
  border: 1px solid #bbf7d0 !important;
  color: #15803d !important;
}
#leadWorkspace .panel-toggle-btn:hover {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #166534 !important;
}
.collapsed-detail #leadWorkspace .panel-toggle-btn {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
}
.collapsed-detail #leadWorkspace .panel-toggle-btn:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}

#leadWorkspace .lead-view-tabs:not([hidden]),
#leadWorkspace .today-sub-tabs:not([hidden]) {
  border-bottom: 1px solid #f1f5f9 !important;
  padding-bottom: 4px !important;
  margin-bottom: 10px !important;
  gap: 6px !important;
  display: flex !important;
  overflow-x: auto !important;
}
#leadWorkspace .lead-view-tabs[hidden],
#leadWorkspace .today-sub-tabs[hidden],
#leadWorkspace [hidden] {
  display: none !important;
}
#leadWorkspace .campaign-tab {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-radius: 7px !important;
  color: #64748b !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  padding: 4px 10px !important;
  min-height: 30px !important;
  gap: 6px !important;
  transition: all 0.15s ease !important;
}
#leadWorkspace .campaign-tab:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
#leadWorkspace .campaign-tab.active {
  background: #f0fdfa !important;
  border-color: #0f766e !important;
  color: #0f766e !important;
  font-weight: 700 !important;
}
#leadWorkspace .campaign-tab-index {
  font-size: 0.64rem !important;
  width: 17px !important;
  height: 17px !important;
  border-radius: 5px !important;
  background: #e2e8f0 !important;
  color: #475569 !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
#leadWorkspace .campaign-tab.active .campaign-tab-index {
  background: #0f766e !important;
  color: #ffffff !important;
}

#leadWorkspace .filters {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin-bottom: 9px !important;
  width: 100% !important;
}
.lead-search-bar-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
#leadWorkspace .search-field {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 0 10px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease !important;
  min-width: 0 !important;
  flex: 1 1 50% !important;
}
#leadWorkspace .search-field:hover {
  border-color: #94a3b8 !important;
}
#leadWorkspace .search-field:focus-within {
  border-color: #0f766e !important;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15) !important;
  background: #ffffff !important;
}
#leadWorkspace .search-field span {
  color: #64748b !important;
  font-size: 0.95rem !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
}
#leadWorkspace .search-field input {
  font-size: 0.84rem !important;
  font-weight: 500 !important;
  border: none !important;
  outline: none !important;
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
  color: #0f172a !important;
  padding: 0 !important;
  min-height: auto !important;
  box-sizing: border-box !important;
}
#leadWorkspace .search-field input::placeholder {
  color: #94a3b8 !important;
  font-weight: 450 !important;
  font-size: 0.82rem !important;
}
.clear-search-btn {
  background: transparent !important;
  border: none !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  font-size: 0.82rem !important;
  padding: 0 4px !important;
  border-radius: 4px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  margin-left: 2px !important;
}
.clear-search-btn:hover {
  color: #475569 !important;
  background: #f1f5f9 !important;
}

/* Nút thêm nhanh khi tìm không thấy khách - nhấp nháy nổi bật */
@keyframes pulseBlinkAddBtn {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    background-color: #059669;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
    background-color: #047857;
    transform: scale(1.03);
  }
}
.lead-quick-add-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 13px !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  background-color: #059669 !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  animation: pulseBlinkAddBtn 1.2s infinite ease-in-out !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3) !important;
  flex-shrink: 0 !important;
}
.lead-quick-add-btn:hover {
  background-color: #047857 !important;
  transform: scale(1.05) !important;
}

/* Chỉ hiển thị các trường lọc còn lại khi ấn Mở rộng bảng danh sách lead */
#leadWorkspace:not(.collapsed-detail) #leadDynamicFilters:not(.has-active-filter) {
  display: none !important;
}
#leadWorkspace.collapsed-detail #leadDynamicFilters,
#leadWorkspace #leadDynamicFilters.has-active-filter {
  display: grid !important;
  grid-template-columns: repeat(var(--lead-filter-cols, 3), minmax(0, 1fr)) !important;
  gap: 7px !important;
  width: 100% !important;
}
#leadWorkspace .filters select {
  height: 31px !important;
  min-height: 31px !important;
  max-height: 31px !important;
  box-sizing: border-box !important;
  font-size: 0.74rem !important;
  font-weight: 500 !important;
  color: #334155 !important;
  background: #ffffff !important;
  border: 1px solid #d8e2ec !important;
  border-radius: 6px !important;
  padding: 0 22px 0 8px !important;
  width: 100% !important;
  min-width: 0 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  cursor: pointer !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 7px center !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
#leadWorkspace .filters select:focus {
  border-color: #2563eb !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12) !important;
}

#leadWorkspace .lead-table-head {
  font-size: 0.66rem !important;
  font-weight: 700 !important;
  color: #64748b !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  padding: 4px 10px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  margin-bottom: 2px !important;
}
#leadWorkspace .lead-card {
  border-radius: 8px !important;
  border: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  min-height: 44px !important;
  padding: 6px 10px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
  transition: all 0.12s ease !important;
}
#leadWorkspace .lead-card:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}
#leadWorkspace .lead-card.selected {
  background: #f0fdfa !important;
  border: 1.5px solid #0f766e !important;
  box-shadow: 0 2px 5px rgba(15, 118, 110, 0.08) !important;
}
#leadWorkspace .lead-avatar {
  border-radius: 7px !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  height: 30px !important;
  width: 30px !important;
  background: #e0f2fe !important;
  color: #0369a1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}
#leadWorkspace .lead-name strong {
  font-size: 0.8rem !important;
  font-weight: 650 !important;
  color: #0f172a !important;
}
#leadWorkspace .lead-name small {
  font-size: 0.68rem !important;
  background: #f1f5f9 !important;
  color: #64748b !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  display: inline-block !important;
  width: fit-content !important;
  font-weight: 500 !important;
}
#leadWorkspace .level-pill {
  font-size: 0.66rem !important;
  font-weight: 600 !important;
  padding: 2px 7px !important;
  border-radius: 5px !important;
  letter-spacing: 0.01em !important;
}
#leadWorkspace .lead-sale {
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  color: #475569 !important;
}
#leadWorkspace .lead-date {
  font-size: 0.72rem !important;
  color: #64748b !important;
}
@media (min-width: 681px) {
  #leadList .lead-grid,
  #campaignPanel .campaign-grid,
  #leadWorkspace .lead-table-head,
  #leadWorkspace .lead-card,
  #campaignPanel .lead-table-head,
  #campaignPanel .lead-card {
    grid-template-columns: var(--lead-columns, repeat(auto-fit, minmax(100px, 1fr))) !important;
  }
  #leadList .lead-grid-0, #campaignPanel .campaign-grid-0 { grid-template-columns: minmax(160px, 1fr); }
  #leadList .lead-grid-1, #campaignPanel .campaign-grid-1 { grid-template-columns: minmax(150px, 2.5fr) minmax(75px, 1fr); }
  #leadList .lead-grid-2, #campaignPanel .campaign-grid-2 { grid-template-columns: minmax(145px, 2.5fr) minmax(70px, 1fr) minmax(50px, 0.8fr); }
  #leadList .lead-grid-3, #campaignPanel .campaign-grid-3 { grid-template-columns: minmax(140px, 2.5fr) minmax(70px, 1fr) minmax(50px, 0.8fr) minmax(70px, 1fr); }
  #leadList .lead-grid-4, #campaignPanel .campaign-grid-4 { grid-template-columns: minmax(140px, 2.5fr) minmax(70px, 1fr) minmax(50px, 0.8fr) repeat(2, minmax(65px, 1fr)); }
  #leadList .lead-grid-5, #campaignPanel .campaign-grid-5 { grid-template-columns: minmax(135px, 2fr) repeat(5, minmax(60px, 1fr)); }
  #leadList .lead-grid-6, #campaignPanel .campaign-grid-6 { grid-template-columns: minmax(130px, 2fr) repeat(6, minmax(55px, 1fr)); }
  #leadList .lead-grid-7, #campaignPanel .campaign-grid-7 { grid-template-columns: minmax(130px, 2fr) repeat(7, minmax(50px, 1fr)); }
  #leadList .lead-grid-8, #campaignPanel .campaign-grid-8 { grid-template-columns: minmax(125px, 2fr) repeat(8, minmax(50px, 1fr)); }
  #leadList .lead-grid-9, #campaignPanel .campaign-grid-9 { grid-template-columns: minmax(125px, 2fr) repeat(9, minmax(48px, 1fr)); }
  #leadList .lead-grid-10, #campaignPanel .campaign-grid-10 { grid-template-columns: minmax(120px, 2fr) repeat(10, minmax(45px, 1fr)); }
  #leadWorkspace #leadList:not(.has-extra-columns) .lead-table-head,
  #leadWorkspace #leadList:not(.has-extra-columns) .lead-card { grid-template-columns: minmax(160px, 1fr); }
}

/* Đảm bảo tên lead là trường ưu tiên số 1, không bao giờ bị co về 0 */
#leadWorkspace .lead-name,
#campaignPanel .lead-name {
  min-width: 140px;
  flex-shrink: 0;
}

#leadWorkspace .lead-table-head,
#leadWorkspace .lead-card,
#campaignPanel .lead-table-head,
#campaignPanel .lead-card {
  min-width: min-content;
  width: 100%;
}

/* Chiến dịch dùng cùng mật độ card với các bảng lead */
#campaignPanel .campaign-heading { margin-bottom: 12px; }
#campaignPanel .campaign-heading,
#campaignPanel .campaign-heading .eyebrow,
#campaignPanel #campaignTitle,
#campaignPanel #campaignCount,
#campaignPanel #createCampaignButton,
#campaignWorkspaceTitle,
#campaignViewNote,
#campaignStatus { display: none !important; }
#campaignPanel .campaign-heading {
  align-items: center !important;
  display: flex !important;
  justify-content: space-between !important;
  margin-bottom: 10px !important;
}
#campaignPanel .campaign-title-line {
  display: inline-flex !important;
  align-items: center !important;
}
#campaignPanel .campaign-heading .eyebrow,
#campaignPanel .campaign-list-heading .eyebrow { font-size: .6rem; margin-bottom: 4px; }
#campaignPanel .campaign-count,
#campaignPanel .campaign-list-heading .muted,
#campaignPanel .campaign-status,
#campaignPanel #campaignUpdatedAt { font-size: .64rem; }
#campaignPanel .campaign-actions { gap: 6px; }
#campaignPanel .campaign-actions .secondary-button,
#campaignPanel .campaign-actions .primary-button { font-size: .64rem; min-height: 34px; padding: 7px 9px; }
#campaignPanel .campaign-tabs { margin-bottom: 10px; }
#campaignPanel .campaign-tab { font-size: .68rem; min-height: 36px; padding: 6px 9px; }
#campaignPanel .campaign-tab-index { font-size: .58rem; height: 19px; width: 19px; }
#campaignPanel .campaign-list { gap: 4px; }
#campaignPanel .lead-table-head,
#campaignPanel .lead-card { gap: 8px; min-width: 0; }
#campaignPanel .lead-table-head { font-size: .6rem; letter-spacing: .04em; padding: 0 10px 5px; }
#campaignPanel .lead-card { border-radius: 7px; min-height: 44px; padding: 6px 10px; }
#campaignPanel .lead-card:hover,
#campaignPanel .lead-card.selected { transform: none; }
#campaignPanel .lead-name { gap: 8px; min-width: 0; }
#campaignPanel .lead-avatar { border-radius: 7px; font-size: .64rem; height: 30px; width: 30px; }
#campaignPanel .lead-name > div,
#campaignPanel .lead-sale,
#campaignPanel .lead-level,
#campaignPanel .campaign-care-cell { min-width: 0; }
#campaignPanel .lead-name strong { font-size: .78rem; line-height: 1.2; overflow: hidden; overflow-wrap: normal; text-overflow: ellipsis; white-space: nowrap; }
#campaignPanel .lead-name small,
#campaignPanel .lead-sale { font-size: .64rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#campaignPanel .level-pill { font-size: .64rem; padding: 4px 7px; }
#campaignPanel .campaign-care-button { border-radius: 6px; font-size: .6rem; min-height: 28px; padding: 5px 7px; }
#campaignPanel .campaign-progress { color: #4c8b42; font-size: .72rem; font-weight: 800; text-align: center; }
#campaignPanel .campaign-list,
#leadWorkspace .lead-list { overflow-x: auto; scrollbar-width: thin; }
#campaignPanel .lead-extra { min-width: 0; font-size: .64rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #65676b; }

/* Responsive tối ưu riêng cho màn hình di động (<= 680px) */
@media (max-width: 680px) {
  #leadWorkspace .lead-table-head,
  #campaignPanel .lead-table-head {
    display: none !important;
  }
  #leadWorkspace .lead-list,
  #campaignPanel .campaign-list {
    max-height: 60vh !important;
    padding-right: 0 !important;
    gap: 8px !important;
    overflow-x: hidden !important;
  }
  #leadWorkspace .lead-card,
  #campaignPanel .lead-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto !important;
    gap: 6px 10px !important;
    padding: 10px 12px !important;
    min-height: auto !important;
    min-width: 0 !important;
    width: 100% !important;
    border-radius: 9px !important;
    background: #ffffff !important;
    border: 1px solid #e1e8e3 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  }
  #leadWorkspace .lead-card.selected,
  #campaignPanel .lead-card.selected {
    border-color: #1e40af !important;
    background: #f8faff !important;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.15) !important;
  }
  #leadWorkspace .lead-card .lead-name,
  #campaignPanel .lead-card .lead-name,
  #leadWorkspace .lead-card .lead-col-highlight,
  #campaignPanel .lead-card .lead-col-highlight {
    grid-column: 1 !important;
    grid-row: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
  }
  #leadWorkspace .lead-card .lead-avatar,
  #campaignPanel .lead-card .lead-avatar {
    height: 32px !important;
    width: 32px !important;
    font-size: 0.68rem !important;
    flex: 0 0 auto !important;
  }
  #leadWorkspace .lead-card .lead-name strong,
  #campaignPanel .lead-card .lead-name strong {
    font-size: 0.84rem !important;
    font-weight: 750 !important;
    color: #1e293b !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
  }
  #leadWorkspace .lead-card .lead-name small,
  #campaignPanel .lead-card .lead-name small {
    font-size: 0.68rem !important;
    color: #64748b !important;
    display: block !important;
    margin-top: 1px !important;
  }
  #leadWorkspace .lead-card .lead-level,
  #campaignPanel .lead-card .lead-level {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: center !important;
    margin: 0 !important;
  }
  #leadWorkspace .lead-card .level-pill,
  #campaignPanel .lead-card .level-pill {
    font-size: 0.65rem !important;
    padding: 3px 7px !important;
    font-weight: 800 !important;
  }
  #leadWorkspace .lead-card .lead-sale,
  #campaignPanel .lead-card .lead-sale {
    grid-column: 1 !important;
    grid-row: 2 !important;
    font-size: 0.68rem !important;
    color: #475569 !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
  }
  #leadWorkspace .lead-card .lead-sale::before,
  #campaignPanel .lead-card .lead-sale::before {
    content: '👤 ' !important;
    font-size: 0.62rem !important;
  }
  #leadWorkspace .lead-card .lead-extra,
  #campaignPanel .lead-card .lead-extra {
    grid-column: 2 !important;
    grid-row: 2 !important;
    justify-self: end !important;
    font-size: 0.68rem !important;
    color: #64748b !important;
    margin: 0 !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
  }
  #leadWorkspace .lead-card .lead-extra::before,
  #campaignPanel .lead-card .lead-extra::before {
    content: '📅 ' !important;
    font-size: 0.62rem !important;
  }
  #leadWorkspace .lead-card .lead-extra ~ .lead-extra,
  #campaignPanel .lead-card .lead-extra ~ .lead-extra {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    justify-self: start !important;
    padding-top: 4px !important;
    border-top: 1px dashed #f1f5f9 !important;
    width: 100% !important;
  }
  #leadWorkspace .lead-card .lead-extra ~ .lead-extra::before,
  #campaignPanel .lead-card .lead-extra ~ .lead-extra::before {
    content: attr(data-label) ': ' !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
  }
}

.campaign-overview { border-bottom: 1px solid #dddfe2; margin-bottom: 14px; padding: 2px 0 14px; }
.campaign-overview-head { align-items: end; display: flex; justify-content: space-between; margin-bottom: 8px; }
.campaign-overview-head h3 { color: #1c1e21; font-size: .9rem; margin: 0; }
.campaign-overview-head .eyebrow { margin-bottom: 3px; }
.campaign-overview-list { display: grid; gap: 6px; }
.campaign-summary-item { align-items: center; background: #f5f6f7; border: 1px solid #dddfe2; border-radius: 8px; display: grid; gap: 10px; grid-template-columns: minmax(180px, 1.2fr) minmax(260px, 1.6fr) auto; padding: 9px 11px; }
.campaign-summary-main { min-width: 0; }
.campaign-summary-main strong, .campaign-summary-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-summary-main strong { color: #1c1e21; font-size: .76rem; }
.campaign-summary-main small { color: #65676b; font-size: .66rem; margin-top: 3px; }
.campaign-summary-facts { display: flex; flex-wrap: wrap; gap: 5px 12px; }
.campaign-summary-facts span { color: #65676b; font-size: .65rem; }
.campaign-summary-facts b { color: #4b4f56; font-weight: 800; }
.campaign-summary-status { align-items: end; display: grid; gap: 3px; justify-items: end; }
.campaign-status-pill { background: #e4e6eb; border-radius: 20px; color: #4b4f56; font-size: .62rem; font-weight: 800; padding: 4px 8px; white-space: nowrap; }
.campaign-status-pill.running, .campaign-status-pill.queued { background: #e7f3ff; color: #385898; }
.campaign-status-pill.completed { background: #e6f4ea; color: #26743d; }
.campaign-status-pill.completed_with_errors, .campaign-status-pill.failed { background: #fff0ed; color: #a63f35; }
.campaign-status-pill.paused { background: #fff7e8; color: #8a641d; }
.campaign-summary-status small { color: #65676b; font-size: .62rem; }
.campaign-meta-fields { margin-top: 0; }
dialog#campaignCreateDialog { max-width: min(560px, calc(100vw - 30px)); }
@media (max-width: 800px) { .campaign-summary-item { grid-template-columns: 1fr; } .campaign-summary-status { align-items: start; justify-items: start; } }

/* Nút thao tác hội thoại: nhẹ, ít chiếm chỗ */
.pancake-toolbar .secondary-button,
.pancake-link-row .secondary-button,
.pancake-linked > .secondary-button { font-size: .64rem; font-weight: 700; }

.care-past-logs { display: grid; gap: 8px; margin: -4px 0 2px; }
.care-past-head { color: #55705f; font-size: .74rem; font-weight: 800; letter-spacing: .02em; margin: 0; }
.care-past-item { background: #f7faf7; border: 1px solid #dce5df; border-radius: 9px; padding: 10px 12px; }
.care-past-item-head { align-items: center; display: flex; justify-content: space-between; margin-bottom: 5px; }
.care-past-item-head strong { color: #173c2f; font-size: .76rem; }
.care-past-item-head small { color: #73857b; font-size: .7rem; }
.care-past-item-content { color: #2d3f35; font-size: .78rem; line-height: 1.5; margin: 0; user-select: text; white-space: pre-wrap; word-break: break-word; }

.time-input-group { display: flex; gap: 8px; align-items: center; }
.time-input-group input { flex: 1; }
.quick-time-btn { white-space: nowrap; padding: 0 12px; font-size: 0.82rem; height: 46px; border: 1px solid #dce5df; }

.settings-tabs { margin-bottom: 24px; border-bottom: 2px solid #e1e8e3; display: flex; gap: 8px; }
.settings-tabs .campaign-tab { padding: 10px 18px; font-weight: 750; font-size: 0.88rem; border-radius: 8px 8px 0 0; background: transparent; color: #607168; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.settings-tabs .campaign-tab.active { background: #fff; color: #173c2f; border-bottom: 2px solid #173c2f; }

#automationDialog {
  max-width: min(1000px, calc(100vw - 40px)) !important;
  width: 100%;
  padding: 30px;
}
#automationListDialog {
  max-width: min(1100px, calc(100vw - 40px)) !important;
  width: 100%;
  padding: 30px;
}
#automationTemplate {
  min-height: 260px;
  font-size: 0.95rem;
  line-height: 1.5;
}
#automationRulesList {
  max-height: 65vh;
  overflow-y: auto;
}

#automationDialog {
  max-width: min(1400px, calc(100vw - 30px)) !important;
  width: 100%;
}
.campaign-automation-composer {
  flex: 1;
  display: flex;
  flex-direction: column;
}
#automationSuggestionsSidebar {
  max-height: min(75vh, 720px);
  overflow-y: auto;
}

.detail-top-actions {
  align-items: stretch;
  display: inline-flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 6px;
}
.detail-top-actions .detail-action-btn {
  width: 100%;
}
.detail-action-btn {
  align-items: center;
  border-radius: 8px;
  box-sizing: border-box;
  display: inline-flex;
  font-size: .74rem;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  line-height: 1;
  min-height: 38px;
  padding: 0 14px;
  transition: all .15s ease;
  white-space: nowrap;
}
#detailAudienceButton.detail-action-btn {
  background: #f0f4f9;
  border: 1px solid #d0dbe7;
  color: #2b4c7e;
  margin-left: 0;
}
#detailAudienceButton.detail-action-btn:hover {
  background: #e2ecf7;
  border-color: #9cb9d8;
  color: #173868;
}
#detailAudienceButton.detail-action-btn.in-audience {
  background: #256b37;
  border-color: #1c522a;
  color: #fff;
}
#detailAudienceButton.detail-action-btn.in-audience:hover {
  background: #a63f35;
  border-color: #8c3229;
  color: #fff;
}
#addCareButton.detail-action-btn {
  border: 1px solid transparent;
}

/* Nút thêm vào Đối tượng riêng & Tìm kiếm chiến dịch */
.lead-name-info { flex: 1 1 auto; min-width: 0; }
.lead-audience-button {
  align-items: center;
  background: #edf5eb;
  border: 1px solid #c7dec1;
  border-radius: 6px;
  color: #2e5929;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: .62rem;
  font-weight: 800;
  gap: 3px;
  line-height: 1.2;
  margin-left: auto;
  padding: 4px 7px;
  transition: all .15s ease;
  white-space: nowrap;
}
.lead-audience-button:hover {
  background: #d8edd3;
  border-color: #5c9c51;
  color: #173c2f;
  transform: translateY(-1px);
}
.lead-audience-button.in-audience {
  background: #256b37;
  border-color: #1c522a;
  color: #fff;
}
.lead-audience-button.in-audience:hover {
  background: #a63f35;
  border-color: #8c3229;
  color: #fff;
}
.lead-audience-button.remove {
  background: #fff0ed;
  border-color: #f1cbc5;
  color: #a63f35;
}
.lead-audience-button.remove:hover {
  background: #a63f35;
  border-color: #8c3229;
  color: #fff;
}
.campaign-filters {
  display: grid;
  grid-template-columns: 1fr;
  margin-bottom: 10px;
}
.campaign-filters .search-field {
  background: #fff;
  border: 1px solid #d8e2ec;
  border-radius: 6px;
  height: 31px;
  min-height: 31px;
  max-height: 31px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
}
.campaign-filters .search-field input {
  font-size: 0.74rem;
  height: 100%;
}


.template-variable-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; }
.tag-insert-btn { background: #f0f4f1; border: 1px solid #d0ded4; border-radius: 6px; color: #2e593f; cursor: pointer; font-size: .7rem; font-weight: 700; padding: 3px 8px; transition: all .15s ease; }
.tag-insert-btn:hover { background: #dceada; border-color: #89b38f; color: #173c2f; }


.campaign-modal-layout {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 420px);
  align-items: start;
}
.campaign-modal-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.campaign-modal-right {
  min-width: 0;
  position: sticky;
  top: 0;
}
.campaign-modal-right .pancake-suggestions {
  max-height: min(75vh, 750px);
  overflow-y: auto;
}
@media (max-width: 900px) {
  .campaign-modal-layout {
    grid-template-columns: 1fr;
  }
  .campaign-modal-right {
    order: 2;
  }
}


#automationTemplate {
  min-height: 260px;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* =========================================
   TRAINING (ĐÀO TẠO) MODULE STYLES (Chuẩn Daotaov4)
   ========================================= */
.training-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 4px 32px;
}

.training-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #fff;
  border: 1px solid #dbe7ef;
  border-radius: 12px;
  padding: 16px 20px;
}

.training-heading h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #123b66;
  margin: 2px 0 0;
}

.training-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 24px;
  align-items: start;
}

.training-sidebar {
  background: #fff;
  border: 1px solid #dbe7ef;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  position: sticky;
  top: 16px;
}

.training-sidebar-actions {
  display: flex;
  gap: 8px;
}

.training-sidebar-actions button {
  flex: 1;
  font-size: 0.72rem;
  font-weight: 700;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.training-sidebar-head {
  padding-bottom: 8px;
  border-bottom: 1px solid #edf4f8;
  font-size: 0.95rem;
  color: #123b66;
}

.training-tree-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.training-cat-node {
  border: 1px solid #e2edf4;
  border-radius: 8px;
  overflow: hidden;
  background: #fafcff;
}

.training-cat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f0f6fa;
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
  font-weight: 700;
  color: #123b66;
  transition: background 0.15s ease;
  gap: 6px;
}

.training-cat-header:hover {
  background: #e2eff7;
}

.training-cat-toggle-btn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: transparent;
  border: none;
  font-weight: 700;
  color: #123b66;
  cursor: pointer;
  padding: 0;
  text-align: left;
  flex: 1;
  min-width: 0;
}

.training-cat-chevron {
  transition: transform 0.2s ease;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: 3px;
}

.training-cat-toggle-btn span:last-child {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.35;
}

.training-cat-chevron.is-open {
  transform: rotate(90deg);
}

.training-cat-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.training-cat-actions button {
  background: transparent;
  border: none;
  padding: 2px 5px;
  border-radius: 4px;
  color: #52758e;
  cursor: pointer;
  font-size: 0.78rem;
}

.training-cat-actions button:hover {
  background: #d8e8f3;
  color: #123b66;
}

.training-lessons-sublist {
  padding: 4px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.training-lesson-node {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #eaf1f6;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.82rem;
  color: #274b69;
  user-select: none;
  gap: 8px;
}

.training-lesson-node.is-dragging {
  opacity: 0.45;
  border: 2px dashed #1f5c91;
  background: #eaf4fb;
}

.training-lesson-node.drag-over {
  border-top: 2px solid #1f5c91;
  background: #eaf4fb;
}

.training-lesson-drag-handle {
  cursor: grab;
  color: #92b0c4;
  font-size: 0.85rem;
  padding: 2px 4px 0 0;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.training-lesson-drag-handle:active {
  cursor: grabbing;
}

.training-lesson-node:hover {
  background: #f0f7fc;
  border-color: #c7e1f2;
}

.training-lesson-node.active {
  background: #123b66;
  border-color: #123b66;
  color: #fff;
  font-weight: 600;
}

.training-lesson-node-left {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.training-lesson-node-left span:not(.training-lesson-drag-handle) {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
  overflow: visible;
  text-overflow: clip;
}

.training-lesson-node-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.training-lesson-node-actions button {
  background: transparent;
  border: none;
  padding: 2px 4px;
  color: #799bb3;
  cursor: pointer;
  font-size: 0.75rem;
}

.training-lesson-node.active .training-lesson-node-actions button {
  color: #a9ddff;
}

.training-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.training-empty-state {
  background: #fff;
  border: 1px solid #dbe7ef;
  border-radius: 12px;
  padding: 60px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.training-empty-cover {
  width: 100%;
  max-width: 480px;
  height: 240px;
  background: linear-gradient(135deg, #123b66 0%, #1f5c91 100%);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 20px;
  box-shadow: 0 10px 24px rgba(18, 59, 102, 0.15);
  position: relative;
  overflow: hidden;
}

.training-empty-cover::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(169, 221, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.training-empty-cover .empty-cover-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.training-empty-cover .empty-cover-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #a9ddff;
  letter-spacing: -0.02em;
}

.training-empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #123b66;
  margin: 0 0 6px;
}

.training-active-lesson {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.training-player-container {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(18, 59, 102, 0.18);
  display: flex;
  flex-direction: column;
}

.training-video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #0c1c2e;
}

.training-video-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.training-video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  cursor: pointer;
  background: transparent;
}

.training-custom-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #091522;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 20;
}

.training-custom-controls .play-btn,
.training-custom-controls .mute-btn {
  background: transparent;
  border: none;
  color: #a9ddff;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.training-custom-controls .play-btn:hover,
.training-custom-controls .mute-btn:hover {
  background: rgba(169, 221, 255, 0.15);
}

.training-custom-controls .video-time {
  color: #a3c7df;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.training-custom-controls .video-seek-bar {
  flex: 1;
  accent-color: #38a5e8;
  cursor: pointer;
  height: 6px;
  border-radius: 3px;
  background: #1f476e;
}

.training-article-card {
  background: #fff;
  border: 1px solid #dbe7ef;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.training-article-header {
  border-bottom: 1px solid #edf4f8;
  padding-bottom: 14px;
}

.training-cat-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #1f5c91;
  background: #eaf4fb;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.training-article-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #123b66;
  margin: 0;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.35;
}

.training-desc-box h4,
.training-image-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #123b66;
  margin: 0 0 10px;
}

.training-desc-text {
  font-size: 0.9rem;
  line-height: 1.65;
  color: #1e3f5c;
  white-space: pre-wrap;
  background: #fbfdff;
  border: 1px solid #e2edf4;
  border-radius: 8px;
  padding: 16px;
}

.training-image-wrapper {
  position: relative;
  background: #f3f8fc;
  border: 1px solid #dbe7ef;
  border-radius: 8px;
  overflow: hidden;
}

.training-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}

.training-doc-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #123b66;
  margin: 0 0 8px;
}

.training-doc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eaf4fb;
  color: #164a78;
  border: 1px solid #bfe0f7;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.training-doc-btn:hover {
  background: #d8edf9;
  border-color: #1f5c91;
  color: #0f355c;
}

@media (max-width: 960px) {
  .training-layout {
    grid-template-columns: 1fr;
  }
  .training-sidebar {
    position: static;
    max-height: none;
  }
}

/* UI Hội thoại theo từng Tab riêng biệt */
.detail-view-tab .channel-dot,
.btn-send-payment-channel .channel-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: 5px;
  background: #ccd0d5;
}
.detail-view-tab .channel-dot.active-linked,
.btn-send-payment-channel .channel-dot.active-linked {
  background: #00c853;
  box-shadow: 0 0 6px rgba(0, 200, 83, 0.6);
}

.btn-send-payment-channel {
  transition: all 0.15s ease;
  font-weight: 500;
}
.btn-send-payment-channel:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.pancake-connect-box {
  background: #ffffff;
  border: 1px solid #dce8e0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.pancake-connect-box-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf2ef;
}
.pancake-connect-box-head .platform-icon-large {
  font-size: 1.8rem;
  line-height: 1;
}
.pancake-connect-box-head h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: #173c2f;
}
.pancake-connect-step {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-start;
}
.pancake-connect-step .step-badge {
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: 800;
  font-size: 0.75rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 6px;
}
.pancake-connect-step .step-content {
  flex: 1;
}
.pancake-connect-step .step-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #334e40;
}
.pancake-active-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f4faf6;
  border: 1px solid #cce5d6;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.pancake-active-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pancake-active-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pancake-open-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  color: #2e7d32;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: none;
}
.pancake-open-link-btn:hover {
  background: #c8e6c9;
}

/* Tinh chỉnh nhỏ gọn khu vực kết nối hội thoại */
.pancake-connect-box {
  padding: 14px 16px !important;
  margin-bottom: 12px !important;
}
.pancake-connect-box-head {
  gap: 10px !important;
  margin-bottom: 12px !important;
  padding-bottom: 10px !important;
}
.pancake-connect-box-head .platform-icon-large {
  font-size: 1.4rem !important;
}
.pancake-connect-box-head h3 {
  font-size: 0.95rem !important;
  margin: 0 0 2px !important;
}
.pancake-connect-box-head p.muted {
  font-size: 0.74rem !important;
}
.pancake-connect-step.compact {
  gap: 10px !important;
  margin-bottom: 12px !important;
}
.pancake-connect-step.compact .step-badge {
  width: 20px !important;
  height: 20px !important;
  font-size: 0.7rem !important;
  margin-top: 4px !important;
}
.pancake-connect-step.compact .step-label {
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  margin-bottom: 4px !important;
  color: #2e593f !important;
}
.pancake-connect-row {
  display: flex !important;
  gap: 6px !important;
  align-items: center !important;
}
.compact-input {
  font-size: 0.74rem !important;
  min-height: 32px !important;
  height: 32px !important;
  padding: 4px 8px !important;
  border-radius: 6px !important;
  border: 1px solid #ccd9d0 !important;
  background: #fdfefe !important;
}
#pancakeConnection.compact-input {
  max-width: 190px !important;
  flex: 0 0 auto !important;
}
#pancakeSearch.compact-input {
  flex: 1 1 auto !important;
  min-width: 140px !important;
}
.conversation-select.compact-input {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  font-size: 0.72rem !important;
}
.compact-btn {
  font-size: 0.74rem !important;
  min-height: 32px !important;
  height: 32px !important;
  padding: 4px 12px !important;
  border-radius: 6px !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
}
.compact-btn.link-btn {
  font-weight: 700 !important;
  color: #173c2f !important;
  background: #e8f5e9 !important;
  border: 1px solid #c8e6c9 !important;
}
.compact-btn.link-btn:hover {
  background: #c8e6c9 !important;
}

/* Tab Mẫu sẵn & Thư viện trong Modal gửi tin & Hộp chat */
.preset-tabs-bar {
  display: flex;
  background: #f1f5f2;
  border-bottom: 1px solid #dce5df;
  padding: 4px;
  gap: 4px;
}
.preset-tab-btn {
  flex: 1;
  text-align: center;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: #4a6355;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-tab-btn:hover {
  background: #e2ede5;
  color: #1b3d2b;
}
.preset-tab-btn.active {
  background: #ffffff;
  color: #173c2f;
  border-color: #ccd9d0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.preset-card {
  background: #ffffff;
  border: 1px solid #e0e8e3;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 7px;
  transition: all 0.15s ease;
}
.preset-card:hover {
  border-color: #89b38f;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.preset-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.preset-card-title {
  font-size: 0.73rem;
  font-weight: 600;
  color: #173c2f;
  margin: 0;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}
.preset-card-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #e8f5e9;
  color: #2e7d32;
}
.preset-card-preview {
  font-size: 0.71rem;
  color: #556e60;
  line-height: 1.38;
  margin: 0 0 6px;
  white-space: pre-wrap;
  max-height: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.preset-use-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 1px 6px;
  font-size: 0.62rem;
  font-weight: 600;
  border-radius: 3px;
  background: #edf7ef;
  border: 1px solid #b7dbbf;
  color: #205c31;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
  line-height: 1.25;
}
.preset-use-btn:hover {
  background: #205c31;
  color: #ffffff;
  border-color: #205c31;
}

/* Giao diện thẻ kịch bản đồng bộ (Kịch bản base & Kịch bản chat) */
.script-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 10px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
  margin-bottom: 8px !important;
  box-sizing: border-box !important;
  text-align: left !important;
  transition: all 0.15s ease !important;
}
.script-card:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}
.script-card-left {
  flex: 1 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  justify-content: flex-start !important;
}
.script-card-topic {
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  color: #0284c7 !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.script-card-title {
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  line-height: 1.35 !important;
  margin: 0 !important;
  white-space: normal !important;
  word-break: break-word !important;
}
.script-card-preview {
  font-size: 0.7rem !important;
  color: #64748b !important;
  line-height: 1.38 !important;
  margin: 0 !important;
  white-space: pre-wrap !important;
  max-height: 60px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 3 !important;
  -webkit-box-orient: vertical !important;
}
.script-card-right {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
  flex-shrink: 0 !important;
  gap: 4px !important;
}
.script-card-thumb {
  width: 72px !important;
  height: 48px !important;
  border-radius: 6px !important;
  overflow: hidden !important;
  border: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}
.script-card-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}
.script-card-thumb.empty {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}
.script-btn-apply {
  width: 100% !important;
  height: 22px !important;
  padding: 0 4px !important;
  border: none !important;
  border-radius: 9999px !important;
  background: linear-gradient(180deg, #38bdf8 0%, #06b6d4 100%) !important;
  color: #082f49 !important;
  font-size: 0.62rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.5px !important;
  cursor: pointer !important;
  box-shadow: 0 2px 5px rgba(6, 182, 212, 0.3) !important;
  transition: all 0.15s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-transform: uppercase !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
}
.script-btn-apply:hover {
  background: linear-gradient(180deg, #06b6d4 0%, #0284c7 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.4) !important;
}
.script-btn-apply:active {
  transform: scale(0.97) !important;
}

.pancake-suggestions .preset-topics-bar,
.pancake-suggestions-column .preset-topics-bar {
  display: flex !important;
  flex-wrap: wrap !important;
  overflow-x: visible !important;
  padding: 0 0 6px !important;
  margin-bottom: 8px !important;
  border-bottom: 1px solid #eef2ef !important;
  gap: 4px !important;
}


/* Thanh công cụ Rich Text Zalo & Hộp màu */
.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: #f1f5f2;
  border: 1px solid #ccd9d0;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 6px 10px;
  gap: 8px;
  margin-top: 4px;
}
.rich-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rich-tool-btn {
  background: #ffffff;
  border: 1px solid #ccd9d0;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.74rem;
  color: #1e3328;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.rich-tool-btn:hover {
  background: #e2ede5;
  border-color: #92b89f;
}
.color-palette-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 1px solid #ccd9d0;
  border-radius: 6px;
  padding: 3px 6px;
}
.color-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #556e60;
  margin-right: 2px;
}
.color-dot-btn {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease;
}
.color-dot-btn:hover {
  transform: scale(1.3);
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}
#campaignPancakeMessage {
  border-radius: 0 0 8px 8px !important;
  border-top: 0 !important;
}
.rich-preview-box {
  margin-top: 6px;
  padding: 8px 12px;
  background: #f8faf9;
  border: 1px dashed #ccd9d0;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #173c2f;
  min-height: 28px;
  display: none;
}
.rich-preview-box.has-content {
  display: block;
}

/* Nút Sửa & Dùng Mẫu trong Preset Card */
.preset-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.preset-edit-btn {
  padding: 5px 8px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #c7decb;
  color: #3b5f48;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.preset-edit-btn:hover {
  background: #eef5f0;
  color: #173c2f;
  border-color: #89b38f;
}
.preset-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 4px;
}
.preset-add-new-btn {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  color: #2e7d32;
  cursor: pointer;
}
.preset-add-new-btn:hover {
  background: #c8e6c9;
}

/* Thu gọn / Mở rộng panel chi tiết bên phải */
.content-grid.collapsed-detail,
.campaign-workspace.collapsed-detail {
  grid-template-columns: minmax(0, 1fr) !important;
}
.content-grid.collapsed-detail #detailPanel,
.campaign-workspace.collapsed-detail #detailPanel {
  display: none !important;
}
.content-grid.collapsed-detail .lead-column,
.campaign-workspace.collapsed-detail .campaign-list-column {
  width: 100% !important;
  max-width: 100% !important;
}
.panel-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f8f3;
  border: 1px solid #c8ded0;
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #173c2f;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.panel-toggle-btn:hover {
  background: #e2ede5;
  border-color: #89b38f;
}
.open-lark-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f4f6fa;
  border: 1px solid #d4dbe8;
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #2b529a;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}
.open-lark-btn:hover {
  background: #e8eef8;
  border-color: #a8bfe3;
}

/* Huy hiệu cảnh báo quá hạn chăm sóc khách */
.overdue-tag {
  display: inline-flex;
  align-items: center;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0 4px;
  margin-left: 5px;
  vertical-align: middle;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.3;
}

/* Chấm tròn biểu thị lịch hẹn chăm sóc ở đầu mỗi hàng lead */
.lead-care-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  min-width: 8px;
  min-height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.lead-care-dot.is-scheduled {
  background-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}
.lead-care-dot.is-unscheduled {
  background-color: #94a3b8;
  box-shadow: 0 0 0 1.5px rgba(148, 163, 184, 0.2);
}
.lead-card:hover .lead-care-dot.is-scheduled {
  transform: scale(1.15);
}
.lead-card:hover .lead-care-dot.is-unscheduled {
  transform: scale(1.1);
}

/* =========================================================
   GIAO DIỆN CẤU HÌNH TINH GIẢN, GỌN ĐẸP (CLEAN & COMPACT SETTINGS UI)
   ========================================================= */
.settings-tabs {
  max-width: 100%;
  margin: 0 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
}
.settings-tabs .campaign-tab {
  padding: 6px 14px;
  font-weight: 650;
  font-size: 0.8rem;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  border: none;
  margin: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}
.settings-tabs .campaign-tab:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.settings-tabs .campaign-tab.active {
  background: #ffffff;
  color: #1877f2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: none;
}

/* 2-column layout for responsive settings cards */
.settings-grid-two {
  max-width: 100%;
  margin: 0 0 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
@media (max-width: 960px) {
.settings-workspace {
  width: 100%;
}
.settings-workspace[hidden] {
  display: none !important;
}

.settings-grid-two {
    grid-template-columns: 1fr;
  }
}

.settings-compact-wrap {
  max-width: 100%;
  margin: 0 0 18px;
}

.settings-card,
.settings-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
#adminSettingsPanel[hidden] {
  display: none !important;
}

.admin-settings-panel {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  padding-bottom: 40px;
}

.settings-panel {
  max-width: 100%;
  margin: 0 0 18px;
}
.settings-panel + .settings-panel {
  margin-top: 12px;
}

/* Titles and captions */
.settings-card .section-title,
.settings-panel .section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.settings-card .section-title h2,
.settings-card .section-title h3,
.settings-panel .section-title h2,
.settings-panel .section-title h3 {
  font-size: 0.94rem;
  margin: 0;
  color: #0f172a;
  font-weight: 700;
}
.settings-card .eyebrow,
.settings-panel .eyebrow {
  font-size: 0.62rem;
  font-weight: 800;
  color: #1877f2;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.settings-card .muted,
.settings-panel .muted {
  font-size: 0.74rem;
  color: #64748b;
  margin: 0 0 8px;
  line-height: 1.35;
}

/* Sub-sections & Forms inside cards */
.settings-card .ai-box-config-form,
.settings-panel .ai-box-config-form {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  margin-top: 6px !important;
  padding: 0 !important;
  box-shadow: none !important;
}
.settings-card label,
.settings-panel label {
  font-size: 0.76rem;
  font-weight: 650;
  color: #334155;
  margin-bottom: 2px;
  display: block;
}
.settings-card input,
.settings-card select,
.settings-card textarea,
.settings-panel input,
.settings-panel select,
.settings-panel textarea {
  font-size: 0.8rem;
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  box-sizing: border-box;
}
.settings-card input:focus,
.settings-card select:focus,
.settings-card textarea:focus,
.settings-panel input:focus,
.settings-panel select:focus,
.settings-panel textarea:focus {
  background: #ffffff;
  border-color: #1877f2;
  box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.12);
}
.settings-card .password-input,
.settings-panel .password-input {
  display: flex;
}
.settings-card .password-input input,
.settings-panel .password-input input {
  flex: 1 1 auto;
}
.settings-card .password-input button,
.settings-panel .password-input button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.74rem;
  border: 1px solid #cbd5e1;
  border-left: none;
  border-radius: 0 6px 6px 0;
  background: #f1f5f9;
}
.settings-card .password-input input {
  border-radius: 6px 0 0 6px;
}

.settings-card .form-two,
.settings-panel .form-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}
.settings-card .checkbox-label,
.settings-panel .checkbox-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e293b;
  gap: 6px;
  display: inline-flex;
  align-items: center;
  margin-bottom: 4px;
  cursor: pointer;
}
.settings-card .checkbox-label input[type="checkbox"],
.settings-panel .checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  min-height: 15px;
  accent-color: #1877f2;
  margin: 0;
  cursor: pointer;
}
.settings-card .field-hint,
.settings-panel .field-hint {
  font-size: 0.67rem;
  color: #64748b;
  margin-top: 1px;
}
.settings-card .config-dialog-actions,
.settings-panel .config-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}

/* Compact connection cards */
.config-list {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}
.compact-card {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 8px 12px !important;
  border-radius: 7px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  transition: all 0.12s ease !important;
  min-height: auto !important;
}
.compact-card:hover {
  border-color: #1877f2 !important;
  background: #ffffff !important;
  box-shadow: 0 1px 4px rgba(24, 119, 242, 0.08) !important;
}
.config-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.config-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.config-title-row strong {
  font-size: 0.84rem;
  color: #0f172a;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}
.status-badge.active {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.status-badge.inactive {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}
.compact-btn {
  min-height: 28px !important;
  padding: 3px 10px !important;
  font-size: 0.74rem !important;
  font-weight: 650 !important;
  border-radius: 5px !important;
}

.lark-base-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #eaf3fd;
  border-radius: 6px;
  font-size: 0.95rem;
  flex: 0 0 auto;
}
.email-channel-icon-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #fcefe3;
  color: #bf6018;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 800;
  flex: 0 0 auto;
}
.empty-tip {
  padding: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  text-align: center;
  color: #64748b;
  font-size: 0.78rem;
  margin: 6px 0 0;
}

.report-metric-fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  padding: 6px 10px;
  margin: 4px 0 6px;
}
.report-metric-fieldset legend {
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
  padding: 0 4px;
}
.report-metric-list {
  display: grid;
  gap: 4px 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.report-metric-list .checkbox-label {
  font-size: 0.72rem;
  margin: 0;
}

.lark-env-section {
  border-top: 1px solid #e2e8f0;
  margin-top: 14px;
  padding-top: 10px;
}

/* =========================================================
   GIAO DIỆN HIỂN THỊ CRM TINH GIẢN, GỌN ĐẸP (CLEAN DISPLAY CONFIG)
   ========================================================= */
.display-settings-panel {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 0 20px !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 18px 22px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
}

.display-config-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 8px 14px !important;
  margin-bottom: 14px !important;
}
.display-config-toolbar label {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  max-width: none !important;
  margin: 0 !important;
}
.display-config-toolbar select {
  padding: 4px 10px !important;
  border-radius: 6px !important;
  border: 1px solid #cbd5e1 !important;
  background: #fff !important;
  font-size: 0.8rem !important;
  min-width: 200px !important;
}
.display-config-toolbar .muted {
  font-size: 0.74rem !important;
  color: #64748b !important;
}

.display-config-editor {
  display: grid !important;
  gap: 16px !important;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
}

@media (min-width: 1360px) {
  .display-config-editor {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
@media (min-width: 768px) and (max-width: 1359px) {
  .display-config-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

.display-field-section {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 12px 14px !important;
  box-shadow: none !important;
}

.display-field-section-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding-bottom: 8px !important;
  margin-bottom: 10px !important;
  border-bottom: 1px solid #eef2f6 !important;
}
.display-section-title-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.display-section-title-input {
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  border-radius: 4px !important;
  padding: 2px 5px !important;
  max-width: 140px !important;
  transition: all 0.15s ease !important;
}
.display-section-title-input:hover {
  border-color: #cbd5e1 !important;
  background: #ffffff !important;
}
.display-section-title-input:focus {
  border-color: #3b82f6 !important;
  background: #ffffff !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15) !important;
}
.display-field-section-head .eyebrow {
  margin: 0 !important;
  font-size: 0.68rem !important;
  font-weight: 800 !important;
  color: #1877f2 !important;
  letter-spacing: 0.04em !important;
}
.display-field-section-head .muted {
  background: #e2e8f0 !important;
  color: #334155 !important;
  padding: 1px 7px !important;
  border-radius: 10px !important;
  font-size: 0.67rem !important;
  font-weight: 700 !important;
}

.display-field-list {
  display: grid !important;
  gap: 6px !important;
  max-height: 420px !important;
  min-height: auto !important;
  overflow-y: auto !important;
  padding-right: 2px !important;
}

.display-field-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  padding: 5px 8px !important;
  min-height: 36px !important;
  transition: all 0.12s ease !important;
}
.display-field-row:hover {
  border-color: #93c5fd !important;
  background: #f8faff !important;
}
.display-field-row.selected {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}
.display-field-row.fixed {
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  opacity: 0.85 !important;
}

.display-field-row label {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
  cursor: pointer !important;
  margin: 0 !important;
  flex: 1 1 auto !important;
}
.display-field-row input[type="checkbox"] {
  width: 15px !important;
  height: 15px !important;
  accent-color: #1877f2 !important;
  cursor: pointer !important;
  margin: 0 !important;
}
.display-field-row label > span {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  min-width: 0 !important;
}
.display-field-row strong {
  color: #1e293b !important;
  font-size: 0.78rem !important;
  font-weight: 650 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.display-field-row small {
  color: #64748b !important;
  font-size: 0.66rem !important;
  margin-top: 0 !important;
  background: #f1f5f9 !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  border: 1px solid #e2e8f0 !important;
}
.display-field-row.selected small {
  background: #dbeafe !important;
  border-color: #bfdbfe !important;
  color: #1e40af !important;
}

.display-drag-handle {
  color: #94a3b8 !important;
  cursor: grab !important;
  font-size: 0.9rem !important;
  line-height: 1 !important;
  user-select: none !important;
}
.display-field-row.dragging {
  opacity: 0.4 !important;
  border: 1px dashed #3b82f6 !important;
}

.display-field-actions {
  display: flex !important;
  gap: 2px !important;
  flex: 0 0 auto !important;
}
.display-move {
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  font-size: 0.7rem !important;
  font-weight: bold !important;
  border-radius: 4px !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
}
.display-move:hover:not(:disabled) {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}
.display-move:disabled {
  opacity: 0.3 !important;
  cursor: not-allowed !important;
}

@media (max-width: 800px) {
  .display-config-editor {
    grid-template-columns: 1fr !important;
  }
}


/* ===== ULTRA-MINIMALIST UI REFINEMENTS ===== */
.eyebrow:empty { display: none !important; }

.detail-panel-label {
  padding: 10px 14px 0 !important;
}

.detail-view-tabs {
  border-bottom: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  overflow-x: auto !important;
  padding-bottom: 8px !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.detail-view-tabs::-webkit-scrollbar {
  display: none !important;
}

.detail-view-tab {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  color: #475569 !important;
  font-size: 0.71rem !important;
  font-weight: 600 !important;
  min-height: 27px !important;
  height: 27px !important;
  line-height: 1 !important;
  padding: 0 8px !important;
  white-space: nowrap !important;
  transition: all 0.15s ease !important;
  cursor: pointer !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  box-shadow: none !important;
}

.detail-view-tab:hover {
  background: #f1f5f9 !important;
  color: #1d4ed8 !important;
  border-color: #cbd5e1 !important;
}

.detail-view-tab.active {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  font-weight: 650 !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25) !important;
}

.detail-view-tab .channel-dot {
  display: inline-block !important;
  width: 6px !important;
  height: 6px !important;
  border-radius: 50% !important;
  margin-left: 2px !important;
  background: #cbd5e1 !important;
  flex-shrink: 0 !important;
}

.detail-view-tab .channel-dot.active-linked {
  background: #10b981 !important;
  box-shadow: 0 0 4px rgba(16, 185, 129, 0.6) !important;
}

.detail-view-tab.active .channel-dot {
  background: rgba(255, 255, 255, 0.45) !important;
}

.detail-view-tab.active .channel-dot.active-linked {
  background: #4ade80 !important;
  box-shadow: 0 0 5px rgba(74, 222, 128, 0.8) !important;
}

.detail-view-tab.detail-care-tab {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
  color: #065f46 !important;
  font-weight: 700 !important;
  padding: 0 10px !important;
}

.detail-view-tab.detail-care-tab:hover {
  background: #d1fae5 !important;
  border-color: #6ee7b7 !important;
  color: #064e3b !important;
}

.detail-view-tab.detail-care-tab.care-button-active {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
  color: #991b1b !important;
  font-weight: 700 !important;
}

.detail-view-tab.detail-care-tab.care-button-active:hover {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #7f1d1d !important;
}

.detail-view-tab.detail-care-tab.care-button-recontact {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  color: #92400e !important;
  font-weight: 700 !important;
}

.detail-view-tab.detail-care-tab.care-button-recontact:hover {
  background: #fef3c7 !important;
  border-color: #fcd34d !important;
  color: #78350f !important;
}

.care-form details {
  border: 1px solid #e1e8e3 !important;
  border-radius: 10px !important;
  background: #fbfdfc !important;
  transition: border-color 0.15s ease !important;
}

.care-form details:hover {
  border-color: #c8d8ce !important;
}

.care-form details summary {
  color: #173c2f !important;
  font-weight: 650 !important;
  outline: none !important;
}

.chart-heading h2 {
  font-size: 0.94rem !important;
  font-weight: 700 !important;
  color: #173c2f !important;
  margin: 0 !important;
}

.compact-btn {
  padding: 6px 14px !important;
  font-size: 0.78rem !important;
  border-radius: 7px !important;
  font-weight: 600 !important;
}

.campaign-tab.open-lark-tab {
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
  color: #15803d !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}
.campaign-tab.open-lark-tab:hover {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #166534 !important;
}

#editPresetDialog {
  z-index: 100010 !important;
  max-width: min(760px, calc(100vw - 32px)) !important;
  width: 740px !important;
  border-radius: 14px !important;
  border: 1px solid #d4dfd7 !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16) !important;
  overflow: hidden !important;
}
#editPresetDialog .care-form {
  max-width: 100% !important;
  width: 100% !important;
  padding: 22px 26px !important;
  background: #ffffff !important;
}
#editPresetDialog textarea {
  min-height: 140px !important;
  font-size: 0.92rem !important;
  line-height: 1.55 !important;
}

.preset-composer-box {
  border: 1px solid #ccd9d0;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.preset-composer-box:focus-within {
  border-color: #2e7d32;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
}
.preset-syntax-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  background: #f8faf9;
  border-bottom: 1px solid #e5ebe7;
}

.preset-syntax-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 1px solid #dce5df;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #1e4533;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1.35;
}
.preset-syntax-chip:hover {
  background: #ebf5ee;
  border-color: #8bb394;
  color: #113622;
  transform: translateY(-1px);
}
.preset-syntax-chip:active {
  transform: translateY(0);
  background: #d4e8da;
}

.preset-card-icon-edit {
  border: none;
  background: transparent;
  padding: 2px 5px;
  font-size: 0.74rem;
  color: #7d9687;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.preset-card:hover .preset-card-icon-edit {
  opacity: 1;
}
.preset-card-icon-edit:hover {
  background: #eef5f0;
  color: #173c2f;
}


.topbar h1, #pageTitle {
  font-size: 1.4rem !important;
  font-weight: 750 !important;
  color: #111827 !important;
  letter-spacing: -0.025em !important;
  line-height: 1.2 !important;
  margin: 0 !important;
}

.topbar {
  align-items: center !important;
  margin-bottom: 22px !important;
}

.topbar-actions {
  padding-top: 0 !important;
}

/* ==================== FOLLOW-UP ACTIVE CAMPAIGNS TAB ==================== */
.followup-nav-tabs {
  margin-bottom: 14px;
}
.active-campaigns-workspace {
  margin-top: 10px;
}
.active-campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}
.followup-campaign-card {
  background: #ffffff;
  border: 1px solid #dce5df;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.followup-campaign-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  border-color: #8dbb55;
}
.followup-campaign-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.followup-campaign-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.followup-campaign-tag {
  font-size: 0.68rem;
  font-weight: 750;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.followup-campaign-tag.type-auto {
  background: #ede9fe;
  color: #6b21a8;
  border: 1px solid #ddd6fe;
}
.followup-campaign-tag.type-broadcast {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.followup-campaign-tag.platform-zalo {
  background: #e6f4ea;
  color: #137333;
  border: 1px solid #ceead6;
}
.followup-campaign-tag.platform-facebook {
  background: #e8f0fe;
  color: #1a73e8;
  border: 1px solid #d2e3fc;
}
.followup-campaign-tag.platform-email {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}
.followup-campaign-title {
  font-size: 0.92rem;
  font-weight: 750;
  color: #17201d;
  margin: 0 0 6px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}
.followup-campaign-desc {
  font-size: 0.78rem;
  color: #51605a;
  line-height: 1.5;
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.followup-campaign-progress-box {
  background: #f7f9f7;
  border: 1px solid #e5ebe7;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.followup-campaign-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  margin-bottom: 6px;
}
.followup-campaign-progress-label {
  color: #51605a;
  font-weight: 600;
}
.followup-campaign-progress-numbers {
  font-weight: 800;
  color: #173c2f;
}
.followup-campaign-progress-bar {
  background: #e1e8e3;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  width: 100%;
}
.followup-campaign-progress-fill {
  background: #173c2f;
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.followup-campaign-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #edf1ed;
  padding-top: 10px;
  margin-top: auto;
}
.followup-campaign-date {
  font-size: 0.7rem;
  color: #88968f;
}
.followup-campaign-card-actions {
  display: flex;
  gap: 6px;
}
.followup-campaign-card-actions button {
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
}

/* ==================== PRESET TEMPLATES PRO MANAGEMENT & TOPIC TABS ==================== */
.preset-topics-bar {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  align-items: center;
  gap: 5px;
  padding: 4px 2px 8px;
  background: transparent;
  border-bottom: 1px solid #eef2ef;
}
.preset-topics-bar::-webkit-scrollbar {
  display: none;
}
#managerTopicChipsBar.preset-topics-bar {
  flex-wrap: wrap;
  overflow-x: visible;
  padding: 0;
  border-bottom: 0;
}
.preset-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid #d4dfd7;
  background: #ffffff;
  color: #3f5547;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.preset-topic-chip:hover {
  background: #ebf5ee;
  border-color: #8bb394;
  color: #1b3d2b;
}
.preset-topic-chip.active {
  background: #173c2f;
  color: #ffffff;
  border-color: #173c2f;
}
.btn-add-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 20px;
  border: 1px dashed #3b82f6;
  background: #eff6ff;
  color: #2563eb;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}
.btn-add-topic-chip:hover {
  background: #dbeafe;
  border-color: #1d4ed8;
  color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}
.preset-channel-tab {
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #4b6354;
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-channel-tab:hover {
  background: #e2ede5;
  color: #173c2f;
}
.preset-channel-tab.active {
  background: #ffffff;
  color: #173c2f;
  border-color: #ccd9d0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.preset-panel-view {
  max-width: 100% !important;
  margin: 0 0 20px !important;
  padding: 20px 24px !important;
}
.preset-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.preset-card-topic-tag {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
}
.preset-card-channel-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}
.preset-card-image-wrap {
  position: relative;
  margin: 6px 0;
  border-radius: 6px;
  overflow: hidden;
  max-height: 140px;
  border: 1px solid #e1e8e3;
  background: #f8faf9;
  text-align: center;
}
.preset-card-image-wrap img {
  max-height: 140px;
  width: 100%;
  object-fit: cover;
  display: block;
}
.preset-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.preset-copy-btn, .preset-edit-btn, .preset-del-btn {
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid #d4dfd7;
  background: #f8faf9;
  color: #374151;
  cursor: pointer;
  transition: all 0.12s ease;
}
.preset-copy-btn:hover {
  background: #e2ede5;
  color: #1b3d2b;
}
.preset-edit-btn:hover {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}
.preset-del-btn:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

/* Thẻ thêm kịch bản mới trong Quản lý Nhập liệu */
#presetManagerGrid .preset-card.preset-add-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  background: #f8fafc !important;
  border: 2px dashed #93c5fd !important;
  border-radius: 10px !important;
  min-height: 200px !important;
  padding: 24px 16px !important;
  cursor: pointer !important;
  user-select: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: none !important;
  margin-bottom: 0 !important;
}
#presetManagerGrid .preset-card.preset-add-card:hover {
  background: #eff6ff !important;
  border-color: #2563eb !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.15) !important;
}
#presetManagerGrid .preset-card.preset-add-card:active {
  transform: translateY(0);
}
.preset-add-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #dbeafe;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}
#presetManagerGrid .preset-card.preset-add-card:hover .preset-add-card-icon {
  background: #2563eb;
  color: #ffffff;
  transform: scale(1.08);
}
.preset-add-card-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 4px;
  transition: color 0.15s ease;
}
#presetManagerGrid .preset-card.preset-add-card:hover .preset-add-card-label {
  color: #1d4ed8;
}
.preset-add-card-desc {
  font-size: 0.76rem;
  color: #64748b;
  max-width: 220px;
  line-height: 1.4;
}

/* ==================== FLOW AUTOMATION CANVAS (3-COLUMN NODE GRAPH) ==================== */
.flow-automation-panel {
  max-width: 100% !important;
  margin: 0 0 20px !important;
  padding: 20px 24px !important;
  border-radius: 16px !important;
  background: radial-gradient(ellipse at 50% -10%, rgba(204, 251, 241, 0.45) 0%, rgba(254, 242, 242, 0.35) 45%, rgba(255, 255, 255, 0.8) 80%) !important;
  border: 1px solid rgba(226, 232, 240, 0.85) !important;
  box-shadow: 0 4px 24px -2px rgba(15, 23, 42, 0.04) !important;
}

.flow-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e1e8e3;
}

.flow-panel-title-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flow-title-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.flow-title-row h2 {
  margin: 0;
  font-size: 1.35rem;
  color: #111827;
  font-weight: 700;
}

.flow-selector-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.flow-dropdown {
  min-width: 240px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #ccd9d0;
  background: #ffffff;
  color: #1f2937;
}

.flow-status-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  flex-shrink: 0;
}

.flow-status-switch input {
  display: none;
}

.flow-switch-slider {
  width: 36px;
  min-width: 36px;
  height: 20px;
  background: #d1d5db;
  border-radius: 20px;
  position: relative;
  transition: background 0.2s;
}

.flow-switch-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.flow-status-switch input:checked + .flow-switch-slider {
  background: #10b981;
}

.flow-status-switch input:checked + .flow-switch-slider::before {
  transform: translateX(16px);
}

.flow-switch-text {
  white-space: nowrap;
  min-width: 66px;
  display: inline-block;
}

.flow-panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 3-Column Node Canvas Grid */
.flow-canvas-container {
  position: relative;
  display: grid;
  grid-template-columns: 320px 360px minmax(360px, 1fr);
  gap: 28px;
  align-items: flex-start;
  min-height: 600px;
  padding: 12px 6px 40px;
}

/* Topbar kịch bản tự động hóa (Tinh gọn, hiện đại) */
.flow-canvas-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  position: relative;
  z-index: 10;
  margin-bottom: 6px;
}

.flow-canvas-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.flow-canvas-indicator-pill {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  white-space: nowrap;
}

.flow-canvas-meta-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.flow-canvas-heading {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

.flow-canvas-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.flow-canvas-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.flow-canvas-btn-run {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}
.flow-canvas-btn-run:hover {
  background: #dcfce7;
  border-color: #4ade80;
  color: #14532d;
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.12);
}

.flow-canvas-btn-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.flow-canvas-btn-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
  box-shadow: 0 2px 6px rgba(185, 28, 28, 0.12);
}

.flow-canvas-btn-save {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.flow-canvas-btn-save:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.flow-svg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.flow-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.flow-col-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  min-height: 48px;
}

.flow-col-header-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.flow-col-step-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  width: fit-content;
  line-height: 1.2;
}

.flow-col-step-pill.step-1 {
  background: #ede9fe;
  color: #6366f1;
}

.flow-col-step-pill.step-2 {
  background: #e0f2fe;
  color: #0284c7;
}

.flow-col-step-pill.step-3 {
  background: #dcfce7;
  color: #16a34a;
}

.flow-col-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}

.flow-col-subtitle {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 500;
}

.flow-col-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.flow-btn-add-action-node {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.flow-btn-add-action-node:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

/* Base Node Card Styling */
.flow-node {
  position: relative;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.flow-node:hover {
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.06);
}

.flow-node-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.flow-node-icon {
  font-size: 1.25rem;
}

.flow-node-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #64748b;
}

.flow-node-title {
  margin: 2px 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}

.flow-node-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-field-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.flow-field-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
}

.flow-field-group input,
.flow-field-group select,
.flow-field-group textarea {
  font-size: 0.8rem;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

.flow-field-group textarea {
  resize: vertical;
  min-height: 50px;
}

/* Ports on Nodes */
.flow-node-port {
  position: absolute;
  top: 32px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #3b82f6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
  transform: translateY(-50%);
  z-index: 5;
  cursor: pointer;
}

.flow-node-port.port-output {
  right: -7px;
}

.flow-node-port.port-input {
  left: -7px;
  border-color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

/* Specific Style for Trigger Node (Gradient Header like sample) */
.flow-node-campaign {
  border-top: 4px solid #6366f1;
}

.flow-node-campaign .flow-node-header {
  background: linear-gradient(135deg, #f8fafc 0%, #ede9fe 100%);
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
}

.flow-node-header-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.flow-node-header-info {
  flex: 1;
  min-width: 0;
}

.flow-node-campaign .flow-node-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  margin: 2px 0 0;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.flow-node-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
  width: 100%;
}

/* Condition Node Style */
.flow-node-conditions {
  border-top: 4px solid #0ea5e9;
}

.flow-conditions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flow-condition-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

.flow-cond-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flow-cond-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 1px 6px;
  border-radius: 4px;
}

.flow-cond-del-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.flow-cond-del-btn:hover {
  color: #ef4444;
}

.flow-cond-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.flow-add-sub-btn {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px dashed #86efac;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.flow-add-sub-btn:hover {
  background: #dcfce7;
  border-color: #4ade80;
}

.flow-time-schedule-box {
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
  margin-top: 4px;
}

.flow-subhead {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}

.flow-schedule-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Action Nodes Container (Column 3) */
.flow-actions-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-node-action {
  border-top: 4px solid #10b981;
}

.flow-node-action.type-facebook {
  border-top-color: #1877f2;
}

.flow-node-action.type-zalo {
  border-top-color: #0068ff;
}

.flow-node-action.type-email {
  border-top-color: #ea580c;
}

.flow-node-action.type-lark_notify {
  border-top-color: #3b82f6;
}

.flow-node-action.type-internal_zalo {
  border-top-color: #0284c7;
}

.flow-action-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-action-del-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 4px;
}

.flow-action-del-btn:hover {
  color: #ef4444;
}

/* SVG Connection Paths */
.flow-wire {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke 0.2s, stroke-width 0.2s;
}

.flow-wire.active-wire {
  stroke: #3b82f6;
  stroke-dasharray: 6 3;
  animation: flowDash 1s linear infinite;
}

@keyframes flowDash {
  to {
    stroke-dashoffset: -9;
  }
}

/* Minimalist additions for Flow Automation */
.flow-notice-banner {
  margin: 0 0 16px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.flow-notice-banner.error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}
.flow-notice-banner.info {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}
.flow-view-stat {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 4px;
}
.flow-cond-val-wrap {
  margin-top: 4px;
}
.flow-cond-val-select,
.flow-cond-val-input {
  width: 100%;
  font-size: 0.8rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  box-sizing: border-box;
}
.flow-cond-preset-btn {
  font-size: 0.7rem;
  padding: 3px 7px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.15s ease;
}
.flow-cond-preset-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.flow-cond-hint {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 6px;
  line-height: 1.4;
}

/* Thêm điều kiện lọc ở cuối Card Điều kiện */
.flow-add-condition-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5e1;
}

.flow-add-cond-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.flow-add-cond-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.flow-add-cond-buttons .flow-cond-btn-choice {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.76rem;
  text-align: center;
}

/* Label hàng có hint phụ */
.flow-field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flow-field-hint {
  font-size: 0.68rem;
  font-weight: normal;
  color: #64748b;
}

/* Tags bar chèn biến tin nhắn */
.flow-action-tags-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.flow-tags-label {
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 600;
}

.flow-insert-tag-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.flow-insert-tag-pill:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
}

.flow-insert-tag-pill.lunar-pill {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.flow-insert-tag-pill.lunar-pill:hover {
  background: #dcfce7;
  border-color: #4ade80;
  color: #14532d;
}

.flow-insert-tag-pill.custom-var-pill {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  font-weight: 700;
}
.flow-insert-tag-pill.custom-var-pill:hover {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e40af;
}

/* ==================== FLOW CAMPAIGN CARDS (HERO & GRID) ==================== */
.flow-campaigns-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e2e8f0;
}

.flow-campaigns-hero {
  text-align: center;
  width: 100%;
  margin: 10px auto 24px;
  position: relative;
}

.flow-campaigns-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  margin-bottom: 16px;
}

.flow-campaigns-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0;
  text-align: center;
}

.flow-search-bar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 4px 6px 4px 20px;
  transition: all 0.2s ease;
  max-width: 650px;
  margin: 0 auto;
}

.flow-search-bar-wrap:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.15);
}

.flow-search-input {
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0.92rem !important;
  flex: 1;
  min-height: 40px !important;
  padding: 0 !important;
  color: #1e293b;
}

.flow-search-btn {
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.15s, background-color 0.15s;
}

.flow-search-btn:hover {
  background: #dc2626;
  transform: scale(1.05);
}

/* CARDS GRID 4 CỘT */
.flow-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.flow-campaign-card {
  position: relative;
  border-radius: 12px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 135px;
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.flow-campaign-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.flow-campaign-card.active-card {
  box-shadow: 0 0 0 2px #2563eb, 0 6px 16px rgba(37, 99, 235, 0.15);
}

/* 4 Theme Color Pastel như ảnh */
.flow-card-theme-cyan {
  background-color: #f0fdfa;
  border-color: #ccfbf1;
}
.flow-card-theme-pink {
  background-color: #fff1f2;
  border-color: #ffe4e6;
}
.flow-card-theme-peach {
  background-color: #fff7ed;
  border-color: #fed7aa;
}
.flow-card-theme-purple {
  background-color: #f5f3ff;
  border-color: #ede9fe;
}
.flow-card-theme-amber {
  background-color: #fefce8;
  border-color: #fef08a;
}
.flow-card-theme-blue {
  background-color: #eff6ff;
  border-color: #bfdbfe;
}

/* Card Header */
.flow-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}

.flow-card-del-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.6;
  transition: all 0.15s ease;
}

.flow-card-del-btn:hover {
  opacity: 1;
  color: #ef4444;
  background: #fee2e2;
}

.flow-card-icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.flow-card-title-wrap {
  flex: 1;
  min-width: 0;
}

.flow-card-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

.flow-card-status-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 3px;
}
.flow-card-status-badge.running {
  background: #dcfce7;
  color: #15803d;
}
.flow-card-status-badge.paused {
  background: #f1f5f9;
  color: #64748b;
}

/* Card Body Note */
.flow-card-desc {
  font-size: 0.75rem;
  color: #475569;
  line-height: 1.4;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 28px;
}

/* Card Actions */
.flow-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.flow-card-open-btn {
  flex: 1;
  border-radius: 8px;
  border: 1px solid #f87171;
  background: #fff;
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.flow-card-open-btn:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

.flow-card-delete-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.flow-card-delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* =========================================================
   CAMPAIGN VIEWS CARD HUB (GIAO DIỆN CARD CHO FOLLOW UP THEO MẪU)
   ========================================================= */
.campaign-views-hub {
  position: relative;
  border-radius: 16px;
  padding: 24px 20px 28px;
  margin-bottom: 20px;
  background: radial-gradient(ellipse at 50% -10%, rgba(204, 251, 241, 0.45) 0%, rgba(254, 242, 242, 0.35) 45%, rgba(255, 255, 255, 0.8) 80%);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 4px 24px -2px rgba(15, 23, 42, 0.04);
}

.campaign-hub-header {
  text-align: center;
  margin-bottom: 24px;
}

.campaign-hub-title {
  margin: 0 0 16px;
  font-size: 1.65rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.campaign-hub-search-container {
  display: flex;
  justify-content: center;
  width: 100%;
}

.campaign-hub-search-box {
  position: relative;
  max-width: 580px;
  width: 100%;
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
  padding: 5px 6px 5px 22px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.campaign-hub-search-box:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 8px 28px -2px rgba(59, 130, 246, 0.22);
}

#campaignHubSearchInput {
  border: none;
  outline: none;
  flex: 1;
  font-size: 0.92rem;
  color: #1e293b;
  background: transparent;
}

#campaignHubSearchInput::placeholder {
  color: #94a3b8;
}

.campaign-hub-search-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  flex-shrink: 0;
}

.campaign-hub-search-btn:hover {
  background: #dc2626;
  transform: scale(1.05);
}

.campaign-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.campaign-view-card {
  background: var(--card-bg, #ffffff);
  border: 1.5px solid var(--card-border, #e2e8f0);
  border-radius: 14px;
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 195px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.campaign-view-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.08);
}

.campaign-view-card.active-card {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25), 0 8px 24px -4px rgba(37, 99, 235, 0.15);
}

.campaign-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-right: 36px;
}

.campaign-card-icon-badge {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.campaign-card-title-wrap {
  min-width: 0;
  flex: 1;
}

.campaign-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

.campaign-card-tag {
  font-size: 0.65rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.campaign-card-body {
  flex: 1;
  margin-bottom: 14px;
}

.campaign-card-note {
  margin: 0 0 6px 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-card-edit-note {
  background: none;
  border: none;
  padding: 0;
  color: #3b82f6;
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
}

.btn-card-edit-note:hover {
  color: #1d4ed8;
}

.campaign-card-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn-card-action {
  background: none;
  border: none;
  padding: 0;
  color: #3b82f6;
  font-size: 0.72rem;
  cursor: pointer;
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.btn-card-action:hover {
  color: #1d4ed8;
}

.btn-card-action.danger {
  color: #ef4444;
}

.btn-card-action.danger:hover {
  color: #b91c1c;
}

/* Condition Row Builder Styles */
.btn-card-delete-corner {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  background: #fff1f2;
  border: 1px solid #fecaca;
  color: #e11d48;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
  z-index: 2;
}

.btn-card-delete-corner:hover {
  background: #fee2e2;
  color: #be123c;
  border-color: #f87171;
  transform: scale(1.08);
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.15);
}

.view-filter-conditions-header {
  display: grid;
  grid-template-columns: 160px 130px 140px 1fr 34px;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 8px 4px;
}

.view-filter-condition-row {
  display: grid;
  grid-template-columns: 160px 130px 140px 1fr 34px;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.view-cond-sample-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  max-height: 72px;
  overflow-y: auto;
  padding: 2px;
}

.view-cond-sample-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-cond-sample-chip:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.2);
}

.view-cond-sample-empty {
  font-size: 0.74rem;
  color: #94a3b8;
  font-style: italic;
}

@media (max-width: 768px) {
  .view-filter-conditions-header {
    display: none;
  }
  .view-filter-condition-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .view-filter-condition-row .view-cond-value-wrap {
    grid-column: 1 / -1;
  }
  .view-filter-condition-row .view-cond-sample-wrap {
    grid-column: 1 / -1;
  }
  .view-filter-condition-row .view-cond-remove-btn {
    grid-column: 2;
    justify-self: end;
  }
}

.view-filter-condition-row select,
.view-filter-condition-row input {
  width: 100%;
  height: 34px;
  padding: 4px 8px;
  font-size: 0.82rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  box-sizing: border-box;
}

.view-filter-condition-row select:focus,
.view-filter-condition-row input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.view-cond-remove-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #ef4444;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: bold;
  transition: all 0.15s ease;
}

.view-cond-remove-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #f87171;
}

.campaign-card-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campaign-card-start-btn {
  background: #ffffff;
  border: 1.5px solid var(--card-btn-border, #fca5a5);
  color: var(--card-btn-color, #ef4444);
  font-weight: 700;
  font-size: 0.84rem;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.18s ease;
}

.campaign-card-start-btn:hover {
  background: var(--card-btn-color, #ef4444);
  color: #ffffff;
  border-color: var(--card-btn-color, #ef4444);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.campaign-card-view-leads-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 6px;
  text-align: center;
  transition: color 0.15s;
}

.campaign-card-view-leads-btn:hover {
  color: #0f172a;
  text-decoration: underline;
}

.campaign-card-view-leads-btn.is-open {
  color: #0f172a;
  font-weight: 700;
}

.campaign-view-card.add-view-card {
  border: 2px dashed #cbd5e1;
  background: #ffffff;
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.campaign-view-card.add-view-card:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.add-view-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
}

.add-view-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.add-view-title {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e293b;
}

.add-view-desc {
  margin: 0 0 8px;
  font-size: 0.76rem;
  color: #94a3b8;
  line-height: 1.35;
}

.add-view-action {
  font-size: 0.78rem;
  font-weight: 700;
  color: #3b82f6;
}

.campaign-workspace-toolbar {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.campaign-workspace-eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 2px;
}

.campaign-workspace-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.campaign-workspace-count {
  background: #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.campaign-workspace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.campaign-workspace.hide-campaign-list {
  grid-template-columns: minmax(0, 1fr) !important;
}

.campaign-workspace.hide-campaign-list .campaign-list-column {
  display: none !important;
}

.detail-list-toggle-btn {
  border-color: #f59e0b !important;
  color: #92400e !important;
  background: #fef3c7 !important;
}

@media (max-width: 768px) {
  .campaign-hub-title {
    font-size: 1.3rem;
  }
  .campaign-cards-grid {
    grid-template-columns: 1fr;
  }
}


/* Card thêm mới với dấu cộng */
.flow-card-add-new {
  border: 2px dashed #93c5fd !important;
  background-color: #f8fafc !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  min-height: 135px !important;
  gap: 8px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.flow-card-add-new:hover {
  border-color: #2563eb !important;
  background-color: #eff6ff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12) !important;
}

.flow-card-add-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: 300;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
  transition: transform 0.2s ease;
}

.flow-card-add-new:hover .flow-card-add-icon {
  transform: scale(1.08);
}

.flow-card-add-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1d4ed8;
}

.flow-campaign-card {
  cursor: pointer;
}

.flow-card-channel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  padding-top: 6px;
}

.flow-channel-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #334155;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.flow-canvas-placeholder {
  padding: 48px 24px;
  text-align: center;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: #64748b;
  margin-top: 16px;
}

/* Cụm gửi tin chat gọn 1 dòng */
.pancake-send-compact {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 6px !important;
}
.pancake-send-compact #pancakeMessage {
  height: 52px !important;
  min-height: 46px !important;
  max-height: 160px !important;
  resize: vertical !important;
  overflow-y: auto !important;
  white-space: pre-wrap !important;
  line-height: 1.4 !important;
  padding: 6px 10px !important;
  font-size: 0.82rem !important;
}
.pancake-send-actions-compact {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  width: 100% !important;
  flex-wrap: nowrap !important;
  margin-top: 2px !important;
}
.pancake-mini-select {
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  min-height: 28px !important;
  height: 28px !important;
  padding: 2px 6px !important;
  border-radius: 6px !important;
  border: 1px solid #c8d6cf !important;
  background: #ffffff !important;
  color: #1e293b !important;
  cursor: pointer;
  outline: none;
}
.pancake-mini-btn {
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  min-height: 28px !important;
  height: 28px !important;
  padding: 2px 10px !important;
  border-radius: 6px !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}
.pancake-mini-btn-skill {
  background: #eef4f9 !important;
  border: 1px solid #c9daf0 !important;
  color: #1a4f8b !important;
}
.pancake-mini-btn-send {
  font-size: 0.74rem !important;
  padding: 2px 14px !important;
}
#pancakeAutoReplyToggle.auto-on {
  background: #e6f4ea !important;
  border: 1px solid #a3d9b1 !important;
  color: #1b7a3d !important;
}

/* Pastel nhẹ toàn app giống tab Tự động hoá */
.workspace {
  background: radial-gradient(ellipse at 50% -10%, rgba(204, 251, 241, 0.45) 0%, rgba(254, 242, 242, 0.35) 45%, rgba(248, 250, 252, 0.9) 80%), #f8fafc;
}
#presetTemplatesPanel.preset-panel-view,
#displayConfigPanel.display-settings-panel,
#settingsConnectionsWrap,
#settingsPaymentWrap,
#larkConnectionsPanel,
#aiBoxConfigPanel,
#crmDailyReportPanel {
  background: radial-gradient(ellipse at 50% -10%, rgba(204, 251, 241, 0.45) 0%, rgba(254, 242, 242, 0.35) 45%, rgba(255, 255, 255, 0.8) 80%) !important;
  border: 1px solid rgba(226, 232, 240, 0.85) !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 24px -2px rgba(15, 23, 42, 0.04) !important;
  padding: 20px 24px !important;
  margin: 0 0 20px !important;
}
/* Tối ưu không gian làm việc cho khu vực KHÁCH HÀNG: bỏ bớt khung bao ngoài, mở rộng diện tích */
#leadWorkspace.content-grid {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: 14px !important;
}
.workspace:has(#leadWorkspace:not([hidden])) {
  padding: 10px 14px 20px !important;
}
.workspace:has(#leadWorkspace:not([hidden])) .topbar {
  margin-bottom: 10px !important;
}
#inlineAddLeadForm.care-form,
.lead-create-form.care-form {
  padding: 10px 12px !important;
  border-radius: 10px !important;
}

#settingsConnectionsWrap,
#settingsPaymentWrap,
#larkConnectionsPanel,
#aiBoxConfigPanel,
#crmDailyReportPanel {
  max-width: 100%;
}
#larkConnectionsPanel {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 1024px) {
  #larkConnectionsPanel {
    grid-template-columns: 1fr;
  }
}
#larkConnectionsPanel[hidden],
#settingsPaymentWrap[hidden],
#aiBoxConfigPanel[hidden],
#crmDailyReportPanel[hidden],
#settingsConnectionsWrap[hidden],
#settingsEmailWrap[hidden] {
  display: none !important;
}
#leadWorkspace .lead-card,
#campaignPanel .lead-card,
#presetManagerGrid .preset-card {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}
/* Mẫu tin kịch bản giữ màu nhẹ */
#presetManagerGrid .preset-card:nth-child(6n+1) { background-color: #f0fdfa; border-color: #ccfbf1; }
#presetManagerGrid .preset-card:nth-child(6n+2) { background-color: #fff1f2; border-color: #ffe4e6; }
#presetManagerGrid .preset-card:nth-child(6n+3) { background-color: #fff7ed; border-color: #fed7aa; }
#presetManagerGrid .preset-card:nth-child(6n+4) { background-color: #f5f3ff; border-color: #ede9fe; }
#presetManagerGrid .preset-card:nth-child(6n+5) { background-color: #eff6ff; border-color: #bfdbfe; }
#presetManagerGrid .preset-card:nth-child(6n) { background-color: #fefce8; border-color: #fef08a; }

/* Danh sách khách hàng: hàng xen kẽ nền trắng và xanh dương pastel rất nhạt */
#leadWorkspace #leadList .lead-card:nth-child(even),
#campaignPanel .campaign-list .lead-card:nth-child(even) {
  background-color: #f4f8fd !important;
  border-color: #e2ecf8 !important;
}

#leadWorkspace #leadList .lead-card:nth-child(odd),
#campaignPanel .campaign-list .lead-card:nth-child(odd) {
  background-color: #ffffff !important;
  border-color: #e8eef5 !important;
}

/* Khi hover hàng lead */
#leadWorkspace #leadList .lead-card:hover,
#campaignPanel .campaign-list .lead-card:hover {
  background-color: #eaf3fb !important;
  border-color: #bcd7f5 !important;
}

/* Khi chọn hàng lead: bôi xanh nhạt lá cây */
#leadWorkspace #leadList .lead-card.selected,
#campaignPanel .campaign-list .lead-card.selected,
.lead-card.selected {
  background-color: #edf7ed !important;
  border-color: #81c784 !important;
  box-shadow: 0 2px 10px rgba(46, 125, 50, 0.12) !important;
}
#settingsConnectionsWrap .settings-card:nth-child(4n+1),
#larkConnectionsPanel .settings-card:nth-child(4n+1),
#aiBoxConfigPanel .settings-card:nth-child(4n+1),
#crmDailyReportPanel .settings-card:nth-child(4n+1) {
  background: #f0fdfa !important;
  border-color: #ccfbf1 !important;
}
#settingsConnectionsWrap .settings-card:nth-child(4n+2),
#larkConnectionsPanel .settings-card:nth-child(4n+2),
#aiBoxConfigPanel .settings-card:nth-child(4n+2),
#crmDailyReportPanel .settings-card:nth-child(4n+2) {
  background: #fff1f2 !important;
  border-color: #ffe4e6 !important;
}
#settingsConnectionsWrap .settings-card:nth-child(4n+3),
#larkConnectionsPanel .settings-card:nth-child(4n+3),
#aiBoxConfigPanel .settings-card:nth-child(4n+3),
#crmDailyReportPanel .settings-card:nth-child(4n+3) {
  background: #f5f3ff !important;
  border-color: #ede9fe !important;
}
#settingsConnectionsWrap .settings-card:nth-child(4n),
#larkConnectionsPanel .settings-card:nth-child(4n),
#aiBoxConfigPanel .settings-card:nth-child(4n),
#crmDailyReportPanel .settings-card:nth-child(4n) {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}
#displayConfigPanel .display-field-section:nth-child(4n+1) {
  background: #f0fdfa !important;
  border-color: #ccfbf1 !important;
}
#displayConfigPanel .display-field-section:nth-child(4n+2) {
  background: #fff7ed !important;
  border-color: #fed7aa !important;
}
#displayConfigPanel .display-field-section:nth-child(4n+3) {
  background: #f5f3ff !important;
  border-color: #ede9fe !important;
}
#displayConfigPanel .display-field-section:nth-child(4n) {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}

/* Khung ghi nhận tương tác inline trong cửa sổ thông tin khách hàng */
.lead-care-inline-slot {
  width: 100%;
}
.lead-care-inline-wrapper {
  background: #f7faf7;
  border: 1.5px solid #c2decb;
  border-radius: 13px;
  box-shadow: 0 4px 14px rgba(23, 60, 47, 0.07);
  margin: 10px 0 14px;
  padding: 12px 14px;
  transition: all 0.2s ease;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
  container-type: inline-size;
}
.lead-care-inline-wrapper[hidden] {
  display: none !important;
}
.lead-care-inline-wrapper .care-form {
  background: transparent;
  border-radius: 0;
  display: grid;
  gap: 11px;
  max-height: none;
  overflow: visible;
  padding: 0;
}
.lead-care-inline-wrapper .dialog-head {
  align-items: center;
  border-bottom: 1px solid #dbe7df;
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}
.lead-care-inline-wrapper .dialog-head h2 {
  color: #173c2f;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
  white-space: nowrap;
}
.lead-care-inline-wrapper .icon-button {
  background: #e8f0eb;
  border: none;
  border-radius: 50%;
  color: #4b6656;
  cursor: pointer;
  font-size: 1.15rem;
  height: 28px;
  line-height: 1;
  transition: all 0.15s ease;
  width: 28px;
}
.lead-care-inline-wrapper .icon-button:hover {
  background: #d4e4d8;
  color: #122c20;
}
.lead-care-inline-wrapper .dialog-lead {
  background: #edf5ea;
  border-radius: 7px;
  color: #3b5e2a;
  font-size: 0.74rem;
  font-weight: 700;
  margin: 0 0 6px;
  padding: 6px 10px;
}
/* Care Purpose Section */
.care-purpose-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 6px;
}
.care-purpose-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: #4b6656;
  white-space: nowrap;
}
.care-purpose-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.care-purpose-chip {
  background: #f1f5f2;
  border: 1px solid #d6e2d9;
  border-radius: 20px;
  color: #314a3c;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  transition: all 0.15s ease;
  line-height: 1.3;
}
.care-purpose-chip:hover {
  background: #e2ede5;
  border-color: #b7cebf;
}
.care-purpose-chip.active {
  background: #17422a;
  border-color: #17422a;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(23, 66, 42, 0.2);
}
.lead-care-inline-wrapper #careContent {
 min-height: 72px;
 resize: vertical;
.lead-care-inline-wrapper #careNote {
  min-height: 52px;
  height: 52px;
  resize: vertical;
}
.lead-care-inline-wrapper #wrapCareNote {
  margin-bottom: 0 !important;
}
}
.care-top-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  align-items: end;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 540px) {
  .care-top-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
.care-top-row > label,
.care-top-row .care-field-item,
.care-top-row .care-field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.care-top-row #followUpFields {
  width: 100%;
}
.care-top-row label,
.care-top-row .care-field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.care-top-row select,
.care-top-row input[type=date],
.care-top-row input[type=text],
.care-top-row input[type=number] {
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1e293b;
  background-color: #fff;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.care-top-row select:focus,
.care-top-row input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
  outline: none;
}
.care-followup-helper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 10px;
}
.care-followup-helper-bar[hidden] {
  display: none !important;
}
.care-helper-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.care-helper-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  user-select: none;
}
.care-dynamic-fields-section {
 display: grid;
 grid-template-columns: 1fr 1fr;
 gap: 10px;
 margin: 4px 0 8px;
 min-width: 0;
 max-width: 100%;
.care-dynamic-fields-section:empty,
#careDynamicFields:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
}
.lead-chat-side-info .care-dynamic-fields-section,
@container (max-width: 480px) {
  .care-dynamic-fields-section {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
}
@media (max-width: 640px) {
  .care-dynamic-fields-section {
    grid-template-columns: 1fr;
  }
}
.care-dynamic-fields-section label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #214332;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
}
.care-dynamic-fields-section textarea,
.care-dynamic-fields-section input,
.care-dynamic-fields-section select {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 6px 10px;
  border: 1px solid #ccd9d0;
  border-radius: 6px;
  background: #ffffff;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}
.care-dynamic-fields-section textarea {
  resize: vertical;
  min-height: 52px;
}
.care-dynamic-fields-section textarea:focus,
.care-dynamic-fields-section input:focus,
.care-dynamic-fields-section select:focus {
  border-color: #2e6f40;
  outline: none;
  box-shadow: 0 0 0 2px rgba(46, 111, 64, 0.15);
}
.lead-care-inline-wrapper .form-two {
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.lead-chat-side-info .lead-care-inline-wrapper .form-two,
@container (max-width: 480px) {
  .lead-care-inline-wrapper .form-two {
    grid-template-columns: 1fr !important;
  }
}
.lead-care-inline-wrapper label,
.lead-care-inline-wrapper select,
.lead-care-inline-wrapper input,
.lead-care-inline-wrapper textarea {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.lead-care-inline-wrapper .care-form-actions {
 display: flex;
 gap: 8px;
 align-items: center;
  margin-top: 2px;
}
.lead-care-inline-wrapper #careMessage:empty,
.lead-care-inline-wrapper .message:empty {
  display: none !important;
  margin: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
}
.lead-care-inline-wrapper .care-form-actions .primary-button {
  flex: 1;
}
.lead-care-inline-wrapper .care-form-actions .secondary-button {
  min-width: 70px;
}

/* ==================== SEPAY & ORDER PAYMENT SYSTEM ==================== */
.lead-payment-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px;
}

/* Header pill & manage button */
.payment-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-view-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.payment-view-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #0f766e;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.payment-view-badge:hover {
  background: #ccfbf1;
}

.payment-view-badge .edit-icon {
  font-size: 0.72rem;
  opacity: 0.75;
}

.payment-sheet-tag {
  font-size: 0.74rem;
  color: #64748b;
}

.payment-sheet-tag strong {
  color: #1e293b;
}

.payment-manage-btn {
  font-size: 0.74rem;
  padding: 4px 10px;
  color: #475569;
  border-color: #e2e8f0;
  background: #ffffff;
}

.payment-lead-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 14px;
}

.payment-summary-divider {
  width: 1px;
  height: 14px;
  background: #e2e8f0;
}

@media (max-width: 640px) {
  .payment-summary-divider {
    display: none;
  }
}

.payment-summary-col {
  display: flex;
  align-items: center;
  gap: 5px;
}

.payment-summary-col .summary-label {
  font-size: 0.74rem;
  color: #64748b;
  font-weight: 500;
}

.payment-summary-col .summary-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
}

.payment-summary-col .summary-value.highlight {
  color: #059669;
}

.payment-summary-col .summary-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.payment-summary-col .summary-badge.badge-paid {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.payment-summary-col .summary-badge.badge-unpaid {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.payment-active-order-card {
  background: #f0fdf4;
  border: 2px solid #34d399;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.08);
}

.payment-active-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed #a7f3d0;
  padding-bottom: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-pulse-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #047857;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background-color: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 1.8s infinite;
}

@keyframes pulseGreen {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.order-code-badge {
  background: #173c2f;
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: monospace;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.payment-qr-split {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: center;
}

@media (max-width: 768px) {
  .payment-qr-split {
    grid-template-columns: 1fr;
  }
}

.payment-qr-image-wrap {
  text-align: center;
  background: #ffffff;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d1fae5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.vietqr-image {
  width: 100%;
  max-width: 230px;
  border-radius: 6px;
  display: block;
  margin: 0 auto 6px;
}

.qr-hint {
  font-size: 0.74rem;
  color: #4b6354;
  margin: 0;
  line-height: 1.35;
}

.payment-order-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payment-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.payment-detail-row .detail-label {
  color: #4b6354;
  min-width: 155px;
}

.payment-detail-row .detail-value {
  color: #173c2f;
  font-weight: 600;
}

.payment-detail-row .amount-text {
  font-size: 1.15rem;
  color: #059669;
  font-weight: 800;
}

.payment-detail-row .highlight-content {
  background: #fef3c7;
  color: #92400e;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px dashed #f59e0b;
  font-family: monospace;
  font-size: 0.95rem;
}

.btn-copy-info {
  background: #eef5f0;
  border: 1px solid #cbdcd1;
  color: #173c2f;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s ease;
}

.btn-copy-info:hover {
  background: #d8ebd9;
}

.btn-copy-info.copied {
  background: #10b981;
  color: #fff;
  border-color: #059669;
}

.payment-active-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #d1fae5;
  flex-wrap: wrap;
}

.payment-create-order-section {
  background: #ffffff;
  border: 1px solid #dce5df;
  border-radius: 10px;
  padding: 14px 16px;
}

.payment-create-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.payment-history-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}

.payment-orders-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  font-size: 0.8rem;
}

.payment-orders-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: 0.73rem;
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.payment-orders-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.order-status-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.74rem;
}

.order-status-tag.status-paid {
  background: #d1fae5;
  color: #065f46;
}

.order-status-tag.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.order-status-tag.status-cancelled {
  background: #f1f5f9;
  color: #64748b;
}

.sepay-tx-code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #334155;
}

/* ==================== 2-COLUMN SIDE-BY-SIDE PAYMENT WORKSPACE ==================== */
.payment-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 900px) {
  .payment-workspace-grid {
    grid-template-columns: 1fr;
  }
}

.payment-form-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.payment-qr-display-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

/* Pricing Grid: Đơn giá & Thành tiền siêu tối giản */
.payment-pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
  align-items: stretch;
  margin: 0;
}

.payment-price-field {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
}

.payment-price-field input {
  font-size: 0.88rem;
  font-weight: 700;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-top: 3px;
  color: #0f172a;
}

.payment-total-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.payment-total-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.payment-total-label {
  font-size: 0.68rem;
  color: #166534;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.payment-calc-pills {
  display: inline-flex;
  align-items: center;
  background: #e2e8f0;
  border-radius: 4px;
  padding: 1.5px;
  gap: 1.5px;
}

.calc-pill {
  display: inline-flex;
  align-items: center;
  padding: 1.5px 6px;
  border-radius: 3px;
  font-size: 0.66rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  margin: 0 !important;
}

.calc-pill input[type="checkbox"] {
  display: none;
}

.calc-pill.active {
  background: #ffffff;
  color: #15803d;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

.payment-total-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.payment-total-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: #15803d;
  line-height: 1.2;
}

.payment-total-hint {
  display: none;
}

/* Checkbox thanh toán ngay siêu gọn */
.payment-cash-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0 2px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: #15803d;
  user-select: none;
}

.payment-cash-checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #16a34a;
  cursor: pointer;
  margin: 0;
}

/* Nút tạo đơn */
.payment-submit-btn {
  width: 100%;
  font-size: 0.88rem;
  padding: 9px 16px;
  font-weight: 700;
  border-radius: 6px;
  background: #2563eb;
  border: 1px solid #1d4ed8;
  color: #ffffff;
  margin-top: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.payment-submit-btn:hover {
  background: #1d4ed8;
}

.payment-submit-btn.btn-complete-order {
  background: #059669;
  border-color: #047857;
  color: #ffffff;
}

.payment-submit-btn.btn-complete-order:hover {
  background: #047857;
}

/* Trường bổ sung theo mẫu */
.custom-order-fields-block {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.custom-order-fields-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.payment-qr-display-card.has-order {
  background: #f0fdf4;
  border: 2px solid #34d399;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.08);
}

.payment-qr-display-card.payment-success-card {
  background: #f0fdf4;
  border: 2px solid #22c55e;
  box-shadow: 0 4px 18px rgba(34, 197, 94, 0.15);
}

.payment-success-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.payment-success-badge {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #15803d;
  background: #dcfce7;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #86efac;
}

.payment-success-check-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #22c55e;
  color: #ffffff;
  font-size: 1.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px auto 12px;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
}

.success-amount-highlight {
  font-size: 1.6rem;
  font-weight: 800;
  color: #15803d;
  margin: 4px 0 10px;
}

.payment-qr-empty-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
  color: #94a3b8;
  background: #fafbfc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 8px;
  height: 100%;
  box-sizing: border-box;
}

.payment-qr-empty-icon {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.payment-qr-empty-title {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 500;
}

.btn-loading {
  background: #047857 !important;
  border-color: #065f46 !important;
  color: #ffffff !important;
  opacity: 0.9 !important;
  cursor: wait !important;
  pointer-events: none !important;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25) !important;
}

.btn-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* PRODUCTS TABLE & INPUT STYLES */
.products-table th, .products-table td {
  border-bottom: 1px solid #e2e8f0;
}
.products-table tbody tr:hover {
  background-color: #f8fafc;
}
.product-code-badge {
  display: inline-block;
  padding: 2px 6px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 0.76rem;
  font-weight: 600;
}
.sepay-account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
}
.sepay-account-item.is-default {
  border-color: #3b82f6;
  background: #eff6ff;
}

/* ==================== ORDERS HISTORY TAB STYLES ==================== */
.orders-history-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.orders-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.orders-filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.orders-filter-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.orders-filter-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.orders-filter-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

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

.payment-history-shortcut-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 14px;
}

.payment-shortcut-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
#leadWorkspace .campaign-care-cell { min-width: 0; display: flex; align-items: center; }
#leadWorkspace .campaign-care-button { border-radius: 6px; font-size: .62rem; min-height: 28px; padding: 5px 8px; font-weight: 700; }


/* ==========================================================
   ADMIN SYSTEM TOOL SWITCHES & HIERARCHY
   ========================================================== */
.admin-tool-switch {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  user-select: none !important;
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
  background: transparent !important;
  border: none !important;
  flex-shrink: 0 !important;
}

.admin-tool-switch input[type="checkbox"] {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  outline: none !important;
  pointer-events: none !important;
  display: none !important;
}

.admin-tool-slider {
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 24px !important;
  min-height: 24px !important;
  background-color: #cbd5e1 !important;
  border-radius: 24px !important;
  position: relative !important;
  transition: background-color 0.2s ease !important;
  display: inline-block !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

.admin-tool-slider::before {
  content: "" !important;
  position: absolute !important;
  top: 2px !important;
  left: 2px !important;
  width: 20px !important;
  height: 20px !important;
  background-color: #ffffff !important;
  border-radius: 50% !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28) !important;
  transition: transform 0.2s ease !important;
}

.admin-tool-switch input[type="checkbox"]:checked + .admin-tool-slider {
  background-color: #10b981 !important;
}

.admin-tool-switch input[type="checkbox"]:checked + .admin-tool-slider::before {
  transform: translateX(20px) !important;
}

.admin-tool-switch.disabled,
.admin-tool-switch:has(input:disabled) {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.admin-tool-label {
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  min-width: 32px !important;
  display: inline-block !important;
  line-height: 1 !important;
  user-select: none !important;
  text-align: left !important;
}

.admin-tool-label.tool-on {
  color: #059669 !important;
}

.admin-tool-label.tool-off {
  color: #dc2626 !important;
}

.perm-col-disabled {
  background: #f1f5f9 !important;
  opacity: 0.45 !important;
  cursor: not-allowed !important;
}

.badge-pkg-disabled {
  display: block !important;
  font-size: 0.65rem !important;
  color: #dc2626 !important;
  background: #fee2e2 !important;
  padding: 1px 4px !important;
  border-radius: 4px !important;
  margin-top: 3px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

/* Khung hiển thị các trường đã chọn ở dưới mỗi cột cấu hình */
.display-selected-summary-panel {
  display: grid !important;
  gap: 16px !important;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
  margin-top: 24px !important;
  padding-top: 18px !important;
  border-top: 2px dashed #cbd5e1 !important;
}
@media (min-width: 1360px) {
  .display-selected-summary-panel {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
@media (min-width: 768px) and (max-width: 1359px) {
  .display-selected-summary-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
.display-summary-col {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 12px 14px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
  display: flex !important;
  flex-direction: column !important;
}
.display-summary-head {
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  color: #1e293b !important;
  margin-bottom: 8px !important;
  padding-bottom: 6px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
}
.display-summary-chips {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  max-height: none !important;
  overflow-y: visible !important;
  padding-right: 4px !important;
}
.display-summary-chip {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  padding: 5px 8px !important;
  font-size: 0.76rem !important;
  color: #334155 !important;
  transition: background 0.15s ease !important;
}
.display-summary-chip:hover {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}
.display-summary-chip .chip-name {
  font-weight: 600 !important;
  color: #0f172a !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 170px !important;
}
.display-summary-chip .chip-actions {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}
.display-summary-chip button {
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  padding: 2px 4px !important;
  font-size: 0.75rem !important;
  border-radius: 4px !important;
  color: #64748b !important;
  line-height: 1 !important;
}
.display-summary-chip button:hover:not(:disabled) {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}
.display-summary-chip button.remove-btn:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

/* HIGHLIGHT FIELD & COLUMN STYLING */
.display-summary-highlight-control {
  margin: 6px 0 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  font-size: 0.74rem !important;
  color: #475569 !important;
  background: #f1f5f9 !important;
  padding: 6px 10px !important;
  border-radius: 6px !important;
  border: 1px solid #e2e8f0 !important;
}
.display-summary-highlight-control label {
  font-weight: 600 !important;
  white-space: nowrap !important;
}
.display-summary-highlight-control select {
  font-size: 0.74rem !important;
  padding: 3px 6px !important;
  border-radius: 5px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  max-width: 180px !important;
}
.display-summary-chip.chip-highlighted {
  border-color: #3b82f6 !important;
  background: #eff6ff !important;
}
.display-summary-chip.chip-highlighted .chip-name {
  font-weight: 700 !important;
  color: #1d4ed8 !important;
}
.chip-highlight-badge {
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  color: #2563eb !important;
  background: #dbeafe !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  margin-left: 4px !important;
}
.summary-highlight-btn {
  background: transparent !important;
  border: none !important;
  font-size: 0.88rem !important;
  color: #cbd5e1 !important;
  cursor: pointer !important;
  padding: 0 4px !important;
  line-height: 1 !important;
  transition: color 0.15s ease !important;
}
.summary-highlight-btn:hover {
  color: #eab308 !important;
}
.summary-highlight-btn.is-active {
  color: #eab308 !important;
}

.lead-col-highlight {
  min-width: 140px !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  overflow: hidden !important;
}
.lead-col-highlight strong {
  font-size: 0.84rem !important;
  font-weight: 750 !important;
  color: #0f172a !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: inline-block !important;
}
.lead-head-highlight {
  font-weight: 800 !important;
  color: #0f172a !important;
}


/* AND / OR LOGIC SELECTOR & BADGES */
.flow-logic-pill-header {
  display: inline-flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  gap: 2px;
}
.flow-header-logic-btn {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}
.flow-header-logic-btn:hover {
  color: #0f172a;
}
.flow-header-logic-btn.active[data-logic="and"] {
  background: #2563eb;
  color: #ffffff;
}
.flow-header-logic-btn.active[data-logic="or"] {
  background: #ea580c;
  color: #ffffff;
}

.flow-cond-logic-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.flow-cond-logic-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
}
.flow-cond-logic-toggle {
  display: inline-flex;
  background: #e2e8f0;
  padding: 2px;
  border-radius: 6px;
  gap: 2px;
}
.flow-cond-logic-btn {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}
.flow-cond-logic-btn:hover {
  color: #0f172a;
}
.flow-cond-logic-btn.active[data-logic="and"] {
  background: #2563eb;
  color: #ffffff;
}
.flow-cond-logic-btn.active[data-logic="or"] {
  background: #ea580c;
  color: #ffffff;
}

.flow-cond-join-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
  position: relative;
}
.flow-cond-join-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #cbd5e1;
  z-index: 0;
}
.flow-cond-join-badge {
  position: relative;
  z-index: 1;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 2px 10px;
  border-radius: 12px;
}
.flow-cond-join-badge.badge-and {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.flow-cond-join-badge.badge-or {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

/* Clickable divider badge */
button.flow-cond-join-badge {
  cursor: pointer;
  transition: all 0.15s ease;
}
button.flow-cond-join-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* Node 1 Trigger Header Status Group & Green Toggle */
.flow-node-status-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
  user-select: none;
}

.flow-node-status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.flow-node-status-pill.is-active,
.flow-node-status-pill.running {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.12);
}
.flow-node-status-pill.is-paused,
.flow-node-status-pill.paused {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

/* Green On/Off Toggle Switch */
.flow-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}
.flow-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  margin: 0;
  padding: 0;
}
.flow-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  border-radius: 24px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}
.flow-toggle-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}
.flow-toggle-switch input:checked + .flow-toggle-slider {
  background-color: #16a34a !important; /* Xanh lá tươi đẹp */
  box-shadow: 0 0 10px rgba(22, 163, 74, 0.45);
}
.flow-toggle-switch input:checked + .flow-toggle-slider::before {
  transform: translateX(20px);
}

/* Nút chọn logic AND / OR: bình thường màu xám, ấn vào mới thành màu xanh */
.flow-header-logic-btn,
.flow-cond-btn-choice {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #64748b !important;
  font-weight: 600 !important;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  user-select: none;
}

.flow-header-logic-btn:hover,
.flow-cond-btn-choice:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #1e293b !important;
  transform: translateY(-1px);
}

/* Khi được ấn vào / đang kích hoạt: chuyển sang màu xanh lá chuẩn đẹp */
.flow-header-logic-btn.is-active,
.flow-header-logic-btn.active,
.flow-cond-btn-choice.is-active,
.flow-cond-btn-choice.active {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #15803d !important;
  font-weight: 700 !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.22) !important;
}

/* ==========================================================================
   TOÀN DIỆN MOBILE & TABLET RESPONSIVE CHO 4 TAB TRỌNG TÂM CRM
   (Tất cả khách hàng, Khách hàng chăm hôm nay, Follow Up, Tự động hoá)
   ========================================================================== */

/* 1. Base CRM Shell & Navigation */
@media (max-width: 800px) {
  html, body {
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
  }

  .crm-shell {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100dvh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 99;
    padding: 10px 14px !important;
    padding-top: max(10px, env(safe-area-inset-top)) !important;
    background: #173c2f;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
  }

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

  .main-nav {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 12px !important;
    margin: 4px 0 0 !important;
    padding-bottom: 2px !important;
  }

  .nav-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    margin-bottom: 0 !important;
  }

  .nav-group-title {
    display: none !important;
  }
  .nav-group-header {
    display: none !important;
  }
  .nav-group.is-collapsed .nav-item {
}

  .main-nav::-webkit-scrollbar {
    display: none !important;
  }

  .nav-item {
    flex: 0 0 auto !important;
    padding: 7px 12px !important;
    font-size: 0.8rem !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    background: rgba(255, 255, 255, 0.08);
  }

  .nav-item.active {
    background: #edf4df !important;
    color: #173c2f !important;
    font-weight: 800 !important;
  }

  .sidebar-bottom {
    display: none !important;
  }

  .workspace {
    padding: 14px 12px 60px !important;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .topbar {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .topbar h1, #pageTitle {
    font-size: 1.25rem !important;
    margin: 0 !important;
  }

 .topbar-actions {
   display: flex !important;
   align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 6px !important;
    padding-top: 0 !important;
  }

  .topbar-actions .button,
  .topbar-actions button {
    font-size: 0.8rem !important;
    padding: 7px 12px !important;
    min-height: 36px !important;
  }
}

/* 2. TAB 1 & 2: "Tất cả khách hàng" & "Khách hàng chăm hôm nay" (#leadWorkspace) */
@media (max-width: 800px) {
  #leadWorkspace.content-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .lead-column {
    min-width: 0 !important;
    width: 100% !important;
  }

  .detail-panel {
    min-width: 0 !important;
    width: 100% !important;
  }

  .mobile-lead-back-btn {
    display: inline-flex !important;
    align-items: center !important;
    background: #e0f2fe !important;
    color: #0369a1 !important;
    font-weight: 800 !important;
    border-color: #bae6fd !important;
  }

  .section-title {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  .section-title h2, #leadSectionTitle {
    font-size: 1.15rem !important;
  }

  .section-title-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .section-title-actions button,
  .section-title-actions a {
    font-size: 0.78rem !important;
    padding: 6px 10px !important;
    min-height: 34px !important;
  }

  .lead-view-tabs:not([hidden]),
  .today-sub-tabs:not([hidden]),
  .period-tabs:not([hidden]) {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 6px !important;
    padding-bottom: 4px !important;
  margin-bottom: 10px !important;
}
.lead-view-tabs[hidden],
.today-sub-tabs[hidden],
.period-tabs[hidden] {
  display: none !important;
}

  .lead-view-tabs::-webkit-scrollbar,
  .today-sub-tabs::-webkit-scrollbar,
  .period-tabs::-webkit-scrollbar {
    display: none !important;
  }

  .lead-view-tabs button,
  .today-sub-tabs button,
  .period-tabs button {
    flex: 0 0 auto !important;
    padding: 7px 12px !important;
    font-size: 0.8rem !important;
    min-height: 36px !important;
    white-space: nowrap !important;
  }

  .filters {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    margin-bottom: 8px !important;
  }

  .search-field {
    grid-column: 1 / -1 !important;
  }

  .search-field input {
    font-size: 0.76rem !important;
    height: 100% !important;
  }

  .filters select {
    font-size: 0.74rem !important;
    height: 31px !important;
    min-height: 31px !important;
    width: 100% !important;
    padding: 0 20px 0 8px !important;
  }

  .lead-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    max-height: none !important;
    overflow-y: visible !important;
  }

  .lead-table-head {
    display: none !important;
  }

  .lead-card {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px 10px !important;
    padding: 12px 14px !important;
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    transition: transform 0.1s ease, border-color 0.15s ease !important;
    min-width: 0 !important;
  }

  .lead-card:active {
    background: #f8fafc !important;
    transform: scale(0.99) !important;
  }

  .lead-card.selected {
    border-color: #173c2f !important;
    background: #f4f8f5 !important;
    box-shadow: 0 2px 8px rgba(23, 60, 47, 0.12) !important;
  }

  .lead-card .lead-name {
    flex: 1 1 200px !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    grid-row: auto !important;
  }

  .lead-card .lead-name::before {
    display: none !important;
  }

  .lead-card .lead-avatar {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
    font-size: 0.85rem !important;
    font-weight: 800 !important;
    flex-shrink: 0 !important;
  }

  .lead-card .lead-name-info {
    flex: 1 !important;
    min-width: 0 !important;
  }

  .lead-card .lead-name-info strong {
    font-size: 0.95rem !important;
    font-weight: 750 !important;
    color: #0f172a !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    line-height: 1.3 !important;
  }

  .lead-card .lead-name-info small {
    font-size: 0.78rem !important;
    color: #64748b !important;
    display: block !important;
    margin-top: 2px !important;
  }

  .lead-card .lead-level {
    flex: 0 0 auto !important;
    margin: 0 !important;
  }

  .lead-card .lead-level::before {
    display: none !important;
  }

  .lead-card .level-pill {
    padding: 3px 8px !important;
    font-size: 0.72rem !important;
    border-radius: 6px !important;
  }

  .lead-card .lead-sale {
    flex: 0 0 auto !important;
    font-size: 0.76rem !important;
    color: #475569 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    margin: 0 !important;
    text-align: left !important;
  }

  .lead-card .lead-sale::before {
    content: "👤 " !important;
    font-size: 0.72rem !important;
    color: #94a3b8 !important;
    display: inline !important;
  }

  .lead-card .lead-extra {
    flex: 0 0 auto !important;
    font-size: 0.76rem !important;
    color: #64748b !important;
    margin: 0 !important;
  }

  .lead-card .lead-extra::before {
    display: none !important;
  }

  .lead-card .campaign-care-cell {
    flex: 0 0 auto !important;
    margin-left: auto !important;
  }

  .lead-card .campaign-care-cell::before {
    display: none !important;
  }

  .lead-card .care-button {
    padding: 6px 14px !important;
    font-size: 0.78rem !important;
    font-weight: 750 !important;
    min-height: 34px !important;
    border-radius: 8px !important;
  }

  .detail-panel {
    border-radius: 14px !important;
    padding: 12px !important;
  }

  .detail-view-tabs {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 4px !important;
    padding-bottom: 2px !important;
    margin-bottom: 12px !important;
    white-space: nowrap !important;
  }

  .detail-view-tabs::-webkit-scrollbar {
    display: none !important;
  }

  .detail-view-tab {
    flex: 0 0 auto !important;
    padding: 0 8px !important;
    font-size: 0.71rem !important;
    min-height: 27px !important;
    height: 27px !important;
    border-radius: 6px !important;
  }

  .detail-top {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .detail-top-actions {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-top: 6px !important;
  }

  .detail-top-actions button {
    flex: 1 1 auto !important;
    min-height: 38px !important;
  }

  .lead-care-inline-slot .form-two {
    grid-template-columns: 1fr !important;
  }
}

/* 3. TAB 3: "Follow Up" (#campaignPanel) */
@media (max-width: 800px) {
  #campaignPanel {
    padding: 0 !important;
  }

  .campaign-heading {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .campaign-actions {
    display: flex !important;
    justify-content: space-between !important;
    margin-top: 4px !important;
  }

  .followup-nav-tabs {
    display: flex !important;
    gap: 6px !important;
    margin-bottom: 14px !important;
  }

  .followup-nav-tab {
    flex: 1 1 auto !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 0.82rem !important;
    min-height: 40px !important;
    padding: 8px 10px !important;
  }

  .campaign-hub-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .campaign-hub-title {
    font-size: 1.15rem !important;
  }

  .campaign-hub-search-box {
    width: 100% !important;
    max-width: 100% !important;
  }

  .campaign-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .campaign-view-card {
    padding: 16px 14px !important;
    border-radius: 14px !important;
  }

  .campaign-view-card-footer {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .campaign-card-start-btn,
  .campaign-card-view-leads-btn {
    width: 100% !important;
    min-height: 40px !important;
    justify-content: center !important;
  }

  .campaign-workspace {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .campaign-workspace-toolbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px !important;
    border-radius: 12px !important;
  }

  .campaign-workspace-actions {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .campaign-workspace-actions button {
    flex: 1 1 auto !important;
    min-height: 40px !important;
    font-size: 0.82rem !important;
    justify-content: center !important;
  }

  .active-campaigns-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* 4. TAB 4: "Tự động hoá" (#automationFlowPanel) */
@media (max-width: 992px) {
  #automationFlowPanel {
    padding: 0 !important;
  }

  .flow-campaigns-hero {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .flow-campaigns-title {
    font-size: 1.18rem !important;
  }

  .flow-search-bar-wrap {
    width: 100% !important;
    max-width: 100% !important;
  }

  .flow-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .flow-canvas-container,
  #flowCanvasContainer {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    padding: 10px 0 30px !important;
  }

  .flow-svg-layer,
  #flowSvgConnections {
    display: none !important;
  }

  .flow-node-port {
    display: none !important;
  }

  .flow-column {
    width: 100% !important;
    min-width: 0 !important;
    position: relative !important;
  }

  .flow-column:not(:last-child)::after {
    content: "▼ Tiếp theo:";
    display: block;
    text-align: center;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 800;
    margin-top: 14px;
    letter-spacing: 0.05em;
  }

  .flow-column-header {
    margin-bottom: 10px !important;
  }

  .flow-node-campaign {
    width: 100% !important;
    border-radius: 14px !important;
    padding: 16px 14px !important;
  }

  .flow-node-conditions {
    width: 100% !important;
    border-radius: 14px !important;
    padding: 16px 14px !important;
  }

  .flow-cond-fields {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .flow-cond-field-select,
  .flow-cond-op-select,
  .flow-cond-val-select,
  .flow-cond-val-input {
    width: 100% !important;
    min-height: 40px !important;
    font-size: 0.88rem !important;
  }

  .flow-time-schedule-box {
    padding: 12px 10px !important;
  }

  #flowAddConditionRow {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  #flowAddConditionRow button {
    width: 100% !important;
    min-height: 38px !important;
    font-size: 0.8rem !important;
  }

  .flow-actions-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .flow-actions-header-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .flow-actions-header-actions button {
    flex: 1 1 45% !important;
    min-height: 38px !important;
    font-size: 0.8rem !important;
    justify-content: center !important;
  }

  #btnSaveFlow {
    flex: 1 1 100% !important;
    min-height: 42px !important;
    font-size: 0.88rem !important;
  }

  .flow-node-action {
    width: 100% !important;
    border-radius: 14px !important;
    padding: 16px 14px !important;
  }

  .flow-action-message-input {
    width: 100% !important;
    min-height: 110px !important;
    font-size: 0.92rem !important;
  }
}

/* 5. Dialogs & Modals chung cho Mobile */
@media (max-width: 768px) {
  dialog {
    max-width: calc(100vw - 16px) !important;
    width: calc(100vw - 16px) !important;
    margin: auto !important;
    border-radius: 16px !important;
    padding: 0 !important;
  }

  .care-form,
  .automation-modal-form {
    padding: 16px 14px !important;
    max-height: 92dvh !important;
  }

  .form-two {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Tránh hiện tượng tự động zoom trên Safari iOS cho tất cả input */
  input[type="text"],
  input[type="search"],
  input[type="password"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="datetime-local"],
  select,
  textarea {
    font-size: 16px !important;
  }
}
/* ==================== FLOW AUTOMATION TABS (LARKBASE STYLE) ==================== */
.flow-tabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin: 0 0 16px;
  padding: 0 2px;
}

.flow-tabs-scroll {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 0;
  flex: 1;
}

.flow-tab-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: grab;
  white-space: nowrap;
  transition: all 0.15s ease;
  border-radius: 6px 6px 0 0;
  position: relative;
  margin-bottom: -2px;
  user-select: none;
  -webkit-user-drag: element;
}

.flow-tab-item:hover {
  color: #1e293b;
  background: rgba(241, 245, 249, 0.6);
}

.flow-tab-item:active {
  cursor: grabbing;
}

.flow-tab-item.is-dragging {
  opacity: 0.4;
  background: #e2e8f0;
  cursor: grabbing;
}

.flow-tab-item.drag-over-left {
  box-shadow: -3px 0 0 0 #2563eb inset;
  background: rgba(37, 99, 235, 0.06);
}

.flow-tab-item.drag-over-right {
  box-shadow: 3px 0 0 0 #2563eb inset;
  background: rgba(37, 99, 235, 0.06);
}

.flow-tab-item.active {
  color: #2563eb;
  font-weight: 700;
  border-bottom-color: #2563eb;
  background: rgba(239, 246, 255, 0.5);
}

.flow-tab-count {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #475569;
}
.flow-tab-item.active .flow-tab-count {
  background: #dbeafe;
  color: #1d4ed8;
}

.flow-tab-edit-icon,
.flow-tab-del-icon {
  opacity: 0;
  font-size: 0.72rem;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 4px;
  line-height: 1;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.flow-tab-item:hover .flow-tab-edit-icon,
.flow-tab-item:hover .flow-tab-del-icon {
  opacity: 0.8;
}
.flow-tab-edit-icon:hover {
  color: #2563eb;
  background: #eff6ff;
}
.flow-tab-del-icon:hover {
  color: #ef4444;
  background: #fee2e2;
}

.flow-tab-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #2563eb;
  background: #eff6ff;
  border: 1px dashed #93c5fd;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}
.flow-tab-add-btn:hover {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1d4ed8;
}

/* Checkbox nhóm Tab trong Trigger Node */
.flow-node-category-checkboxes {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  max-height: 140px;
  overflow-y: auto;
}

label.flow-category-check-item {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 7px !important;
  font-size: 0.76rem !important;
  font-weight: 500 !important;
  color: #334155 !important;
  cursor: pointer !important;
  user-select: none !important;
  padding: 3px 6px !important;
  border-radius: 5px !important;
  transition: background 0.12s ease;
  min-height: unset !important;
  width: auto !important;
  margin: 0 !important;
}

label.flow-category-check-item:hover {
  background: #f1f5f9;
  color: #0f172a !important;
}

label.flow-category-check-item input[type="checkbox"],
input[type="checkbox"].flow-node-cat-checkbox {
  width: 13px !important;
  min-width: 13px !important;
  max-width: 13px !important;
  height: 13px !important;
  min-height: 13px !important;
  max-height: 13px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 3px !important;
  cursor: pointer !important;
  accent-color: #2563eb !important;
  box-shadow: none !important;
  outline: none !important;
  flex-shrink: 0 !important;
}

label.flow-category-check-item span {
  font-size: 0.75rem !important;
  line-height: 1.3 !important;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

label.flow-category-check-item:has(input:checked) {
  background: #eff6ff;
  color: #1d4ed8 !important;
}

label.flow-category-check-item:has(input:checked) span {
  color: #1d4ed8 !important;
  font-weight: 600 !important;
}

/* =========================================================
   TÙY BIẾN LOGO & NHẬN DIỆN THƯƠNG HIỆU (APP BRANDING)
   ========================================================= */
.side-brand-custom-logo,
#appBrandLogoImg {
  width: 34px !important;
  height: 34px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  object-fit: contain !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  padding: 2px !important;
  flex-shrink: 0 !important;
}

.login-brand-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.login-brand-logo {
  max-height: 44px;
  max-width: 140px;
  object-fit: contain;
  border-radius: 8px;
}

.admin-sub-tabs {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-sub-tabs .campaign-tab {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-sub-tabs .campaign-tab:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.admin-sub-tabs .campaign-tab.active {
  background: #173c2f;
  color: #ffffff;
  border-color: #173c2f;
  box-shadow: 0 2px 6px rgba(23, 60, 47, 0.25);
}

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

.campaign-hub-title-row,
.flow-campaigns-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 16px;
}
.campaign-hub-title-row .campaign-hub-title,
.flow-campaigns-title-row .flow-campaigns-title {
  margin: 0;
  text-align: center;
}
.hub-refresh-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
@media (max-width: 768px) {
  .campaign-hub-title-row,
  .flow-campaigns-title-row {
    flex-direction: column;
    gap: 10px;
  }
  .hub-refresh-btn {
    position: static;
    transform: none;
  }
}


/* Hiệu ứng trạng thái nút Làm mới ở Hub Follow Up */
.hub-refresh-btn.refreshing {
  opacity: 0.85;
  cursor: wait !important;
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}
.hub-refresh-btn.refresh-done {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
  color: #059669 !important;
  font-weight: 700 !important;
}

/* ==========================================================================
   ADMIN SETTINGS: GÓI CÔNG CỤ HỆ THỐNG & QUẢN LÝ MANAGER PHÂN QUYỀN
   ========================================================================== */

.admin-card-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-card-header-left {
  flex: 1;
  min-width: 280px;
}

.admin-card-header-title {
  font-size: 1.12rem;
  font-weight: 750;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}

.admin-card-header-desc {
  font-size: 0.85rem;
  color: #64748b;
  margin: 5px 0 0;
  line-height: 1.45;
}

.admin-summary-pill-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.admin-summary-pill.active-pill {
 background: #ecfdf5;
 color: #047857;
 border-color: #a7f3d0;
.admin-summary-pill.partial-pill {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.admin-summary-pill.partial-pill .pill-dot {
  background: #f59e0b;
}

.admin-summary-pill.inactive-pill {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.admin-summary-pill.inactive-pill .pill-dot {
  background: #ef4444;
}

}

.admin-summary-pill .pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

/* Callout Banner */
.admin-info-callout {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.admin-info-callout .callout-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.admin-info-callout .callout-text {
  font-size: 0.83rem;
  color: #166534;
  line-height: 1.5;
}

/* Lưới 6 Gói Công Cụ Cốt Lõi (3x2 cân đối) */
.admin-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 16px;
}

@media (min-width: 1280px) {
  .admin-tool-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.admin-tool-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.admin-tool-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.admin-tool-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.admin-tool-card-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-tool-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.icon-chat { background: #eff6ff; color: #1d4ed8; }
.icon-payment { background: #fffbeb; color: #b45309; }
.icon-email { background: #f5f3ff; color: #6d28d9; }
.icon-auto { background: #ecfdf5; color: #047857; }
.icon-ai { background: #fdf2f8; color: #be185d; }
.icon-report { background: #f0f9ff; color: #0369a1; }

.admin-tool-card-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}

.admin-tool-card-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  margin-top: 3px;
}

.admin-tool-card-body {
  flex: 1;
}

.admin-tool-card-desc {
  font-size: 0.81rem;
  color: #64748b;
  line-height: 1.48;
  margin: 0 0 10px;
}

.admin-tool-features-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-tool-feature-chip {
  font-size: 0.72rem;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 8px;
  font-weight: 500;
}

/* Sub-toggle trong card */
.admin-tool-sub-box {
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.admin-tool-sub-left {
  flex: 1;
  min-width: 0;
}

.admin-tool-sub-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.admin-tool-sub-desc {
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.35;
  margin: 0;
}

.admin-tool-card-footer {
  padding-top: 10px;
  border-top: 1px dashed #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: #94a3b8;
}

/* ==========================================================================
   PHẦN QUẢN LÝ MANAGER & PHÂN QUYỀN
   ========================================================================== */

.admin-mfa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.admin-mfa-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
}

.admin-mfa-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
}

.admin-mfa-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.admin-mfa-card-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-mfa-card-desc {
  font-size: 0.8rem;
  color: #64748b;
  margin: 4px 0 0;
  line-height: 1.4;
}

.admin-mfa-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  transition: opacity 0.2s ease;
}

.admin-mfa-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin: 0;
  user-select: none;
}

.admin-mfa-sub-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.admin-mfa-sub-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #059669;
}

.admin-manager-table-wrapper {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
}

.admin-manager-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #173c2f;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.76rem;
  margin-right: 8px;
  vertical-align: middle;
  text-transform: uppercase;
}

/* =========================================================
   MODAL XUẤT DỮ LIỆU KHÁCH HÀNG (MINIMAL & COMPACT)
   ========================================================= */
dialog#exportLeadsDialog.export-modal,
dialog#exportFinanceDialog.export-modal {
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 14px !important;
  max-width: 380px !important;
  width: 92vw !important;
  background: #ffffff !important;
  box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(15, 23, 42, 0.08) !important;
  overflow: hidden !important;
  z-index: 10000 !important;
}
dialog#exportLeadsDialog.export-modal:not([open]),
dialog#exportFinanceDialog.export-modal:not([open]) {
  display: none !important;
}
dialog#exportLeadsDialog.export-modal[open],
dialog#exportFinanceDialog.export-modal[open] {
  display: block !important;
}
dialog#exportLeadsDialog::backdrop,
dialog#exportFinanceDialog::backdrop {
  background: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(2px) !important;
}
.export-card {
  background: #ffffff !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  padding: 0 !important;
  gap: 0 !important;
  max-height: 90vh !important;
}
.export-card-header {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  padding: 14px 18px 12px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  background: #ffffff !important;
}
.export-header-title h3 {
  margin: 0 !important;
  font-size: 0.95rem !important;
  font-weight: 750 !important;
  color: #0f172a !important;
  line-height: 1.3 !important;
}
.export-header-title p {
  margin: 2px 0 0 !important;
  font-size: 0.73rem !important;
  color: #64748b !important;
}
.export-close-btn {
  background: transparent !important;
  border: none !important;
  font-size: 1.05rem !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  padding: 3px 6px !important;
  border-radius: 6px !important;
  transition: all 0.15s !important;
  line-height: 1 !important;
  min-height: auto !important;
  width: auto !important;
}
.export-close-btn:hover {
  color: #0f172a !important;
  background: #f1f5f9 !important;
}
.export-card-body {
  padding: 14px 18px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 13px !important;
}
.export-field-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
}
.export-group-label {
  font-size: 0.67rem !important;
  font-weight: 750 !important;
  color: #64748b !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
}
.export-pill-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  background: #f1f5f9 !important;
  padding: 3px !important;
  border-radius: 8px !important;
  gap: 4px !important;
}
.export-pill-item {
  cursor: pointer !important;
  margin: 0 !important;
  display: block !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
}
.export-pill-item input[type="radio"] {
  display: none !important;
}
.export-pill-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  height: 32px !important;
  border-radius: 6px !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: #64748b !important;
  transition: all 0.15s ease !important;
  user-select: none !important;
}
.export-pill-item:hover .export-pill-btn {
  color: #0f172a !important;
}
.export-pill-item input:checked + .export-pill-btn {
  background: #ffffff !important;
  color: #0f766e !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}
.export-scope-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}
.export-scope-card {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 8px 12px !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  margin: 0 !important;
  background: #ffffff !important;
}
.export-scope-card input[type="radio"] {
  display: none !important;
}
.export-scope-card:hover {
  border-color: #cbd5e1 !important;
  background: #f8fafc !important;
}
.export-scope-card:has(input:checked) {
  border-color: #0f766e !important;
  background: #f0fdfa !important;
}
.export-scope-content {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  flex: 1 !important;
  min-width: 0 !important;
}
.export-scope-head {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.export-scope-head strong {
  font-size: 0.8rem !important;
  font-weight: 650 !important;
  color: #1e293b !important;
}
.export-count-badge {
  font-size: 0.67rem !important;
  font-weight: 700 !important;
  padding: 1px 6px !important;
  border-radius: 10px !important;
  background: #e2e8f0 !important;
  color: #475569 !important;
}
.export-scope-card:has(input:checked) .export-count-badge {
  background: #ccfbf1 !important;
  color: #0f766e !important;
}
.export-scope-desc {
  font-size: 0.71rem !important;
  color: #64748b !important;
}
.export-custom-radio {
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  border: 1.5px solid #cbd5e1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  transition: all 0.15s !important;
  margin-left: 10px !important;
}
.export-custom-radio::after {
  content: '' !important;
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  background: #0f766e !important;
  transform: scale(0) !important;
  transition: transform 0.15s ease !important;
}
.export-scope-card:has(input:checked) .export-custom-radio {
  border-color: #0f766e !important;
}
.export-scope-card:has(input:checked) .export-custom-radio::after {
  transform: scale(1) !important;
}
.export-card-footer {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 11px 18px !important;
  background: #f8fafc !important;
  border-top: 1px solid #f1f5f9 !important;
}
.export-btn-secondary {
  height: 32px !important;
  padding: 0 13px !important;
  border-radius: 7px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #475569 !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
  min-height: auto !important;
  width: auto !important;
}
.export-btn-secondary:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}
.export-btn-primary {
  height: 32px !important;
  padding: 0 15px !important;
  border-radius: 7px !important;
  border: 1px solid #0f766e !important;
  background: #0f766e !important;
  color: #ffffff !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  transition: all 0.15s !important;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.2) !important;
  min-height: auto !important;
  width: auto !important;
}
.export-btn-primary:hover {
  background: #115e59 !important;
  border-color: #115e59 !important;
}
.export-btn-primary:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
}
.export-form-msg {
  font-size: 0.74rem !important;
  padding: 6px 10px !important;
  border-radius: 6px !important;
  margin: 0 !important;
  line-height: 1.35 !important;
}
.export-form-msg.error {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
}
.export-form-msg.info {
  background: #f0fdfa !important;
  color: #0f766e !important;
  border: 1px solid #99f6e4 !important;
}
.export-form-msg.success {
  background: #f0fdf4 !important;
  color: #166534 !important;
  border: 1px solid #bbf7d0 !important;
}
.refresh-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid #94a3b8;
  border-top-color: #0f766e;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}


/* CSS chuẩn cho tất cả nút làm mới đồng bộ theo kiểu hub-refresh-btn */
.static-hub-btn {
  position: static !important;
  transform: none !important;
}
.hub-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.82rem !important;
  height: 36px;
  min-height: 36px !important;
  padding: 0 14px !important;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.hub-refresh-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.hub-refresh-btn.refreshing,
.secondary-button.refreshing {
  opacity: 0.85;
  cursor: wait !important;
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}
.hub-refresh-btn.refresh-done,
.secondary-button.refresh-done {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
  color: #059669 !important;
  font-weight: 700 !important;
}

.refresh-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

#leadWorkspace .today-sub-tabs:not([hidden]) {
  background: #f8fafc !important;
  border: 1px dashed #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 4px 8px !important;
  align-items: center !important;
}
#leadWorkspace .today-sub-tabs .campaign-tab {
  background: #ffffff !important;
  font-size: 0.74rem !important;
  min-height: 26px !important;
  padding: 2px 8px !important;
}
#leadWorkspace .today-sub-tabs .campaign-tab.active {
  background: #0f766e !important;
  color: #ffffff !important;
  border-color: #0f766e !important;
}
#leadWorkspace .today-sub-tabs .campaign-tab.active .campaign-tab-index {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}
#leadWorkspace .campaign-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  background: #ef4444;
  color: #ffffff;
  margin-left: 4px;
}
#leadWorkspace .campaign-tab.active .campaign-tab-badge {
  background: #0f766e;
  color: #ffffff;
}

/* --- CRM B2B / B2C Toggle & Care Cards --- */
.crm-mode-toggle-group {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid #cbd5e1;
  gap: 3px;
}
.crm-mode-toggle-group .mode-toggle-btn {
  background: transparent;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.crm-mode-toggle-group .mode-toggle-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}
.crm-mode-toggle-group .mode-toggle-btn.active {
  background: #ffffff;
  color: #0f766e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 700;
}
.b2c-quick-care-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.b2c-quick-care-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: #15803d;
}
.b2c-quick-care-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.b2c-action-btn {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #86efac;
  background: #ffffff;
  color: #166534;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.b2c-action-btn:hover {
  background: #dcfce7;
  border-color: #4ade80;
}

/* ==================== B2C INLINE ADD LEAD & INSTANT ORDER / VIETQR ==================== */
.b2c-add-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(380px, 1.35fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 960px) {
  .b2c-add-grid {
    grid-template-columns: 1fr;
  }
}
.b2c-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.b2c-order-card {
  background: #f8fafc;
  border: 1px solid #94a3b8;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.b2c-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
  margin-bottom: 2px;
}
.b2c-card-title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.b2c-method-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 8px;
}
.b2c-method-btn {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 4px;
  text-align: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.b2c-method-btn.active {
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.b2c-qr-preview-box {
  background: #ffffff;
  border: 1.5px solid #10b981;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  gap: 16px;
  align-items: center;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
}
.b2c-qr-image-wrap {
  flex-shrink: 0;
  width: 195px;
  height: 195px;
  background: #fff;
  border: 1.5px solid #86efac;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.b2c-qr-image {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}
.b2c-qr-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
}
.b2c-qr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
}
@media (max-width: 640px) {
  .b2c-qr-preview-box {
    flex-direction: column;
    align-items: center;
  }
}

/* Product Config Dialog specific styling */
#productConfigDialog input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: #16a34a !important;
  box-sizing: border-box !important;
}

@media (max-width: 640px) {
  #productConfigDialog .product-config-col-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Finance Config Dialog specific styling */
#financeConfigDialog input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: #0f766e !important;
  box-sizing: border-box !important;
}

@media (max-width: 640px) {
  #financeConfigDialog .finance-config-col-grid {
    grid-template-columns: 1fr !important;
  }
}

.b2c-order-view-card:hover {
  border-color: #15803d !important;
  box-shadow: 0 4px 14px rgba(21, 128, 61, 0.16) !important;
  transform: translateY(-1px);
}

.order-view-card {
  cursor: pointer;
}

.order-view-card:hover {
  border-color: #10b981 !important;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.14) !important;
  transform: translateY(-2px);
}

/* ==================== LARK BASE STYLE FOR FINANCE (DOANH THU & CHI PHÍ) ==================== */
.lark-base-table-container {
  background: #ffffff;
  border: 1px solid #dee0e3;
  border-radius: 6px;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(31, 35, 41, 0.04);
  margin-top: 10px;
}

.lark-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #1f2329;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.35;
  min-width: 800px;
}

.lark-grid-table thead th {
  background: #f5f6f7;
  color: #646a73;
  font-weight: 500;
  font-size: 12px;
  padding: 5px 8px;
  height: 34px;
  box-sizing: border-box;
  border-right: 1px solid #dee0e3;
  border-bottom: 1px solid #dee0e3;
  white-space: nowrap;
  user-select: none;
  text-align: left;
}

.lark-grid-table thead th .lark-th-content {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.lark-grid-table thead th .lark-th-icon {
  font-size: 11px;
  opacity: 0.85;
}

.lark-grid-table thead th.lark-th-draggable {
  cursor: grab;
  transition: background-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.lark-grid-table thead th.lark-th-draggable:active {
  cursor: grabbing;
}

.lark-grid-table thead th.lark-th-draggable .lark-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #94a3b8;
  opacity: 0.55;
  cursor: grab;
  margin-right: 2px;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.lark-grid-table thead th.lark-th-draggable:hover .lark-drag-handle {
  opacity: 1;
  color: #0284c7;
}

.lark-grid-table thead th.lark-th-dragging {
  opacity: 0.35 !important;
  background: #f1f5f9 !important;
  cursor: grabbing !important;
}

.lark-grid-table thead th.lark-th-drag-over {
  background: #e0f2fe !important;
  outline: 2px dashed #0284c7 !important;
  outline-offset: -2px;
  box-shadow: inset 0 0 0 1px #38bdf8;
}

.lark-grid-table .lark-col-idx {
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  text-align: center;
  color: #8f959e;
  font-size: 11px;
  background: #fafbfc;
  border-right: 1px solid #dee0e3;
  border-bottom: 1px solid #dee0e3;
  user-select: none;
  padding: 3px 4px;
}

.lark-grid-table tbody td {
  padding: 4px 8px;
  height: 32px;
  box-sizing: border-box;
  border-right: 1px solid #dee0e3;
  border-bottom: 1px solid #dee0e3;
  font-size: 12px;
  color: #1f2329;
  vertical-align: middle;
  white-space: nowrap;
}

.lark-grid-table tbody tr:hover {
  background-color: #f8f9fa;
}

.lark-grid-table tbody tr:hover .lark-col-idx {
  background-color: #f0f1f3;
  color: #1f2329;
}

.lark-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 4px;
}

.lark-code-badge {
  display: inline-block;
  padding: 1px 6px;
  background: #f2f3f5;
  border: 1px solid #d0d3d6;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  color: #1f2329;
  letter-spacing: 0.2px;
}

.lark-checkbox-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border: 1.5px solid #8f959e;
  border-radius: 3px;
  background: #ffffff;
}

.lark-checkbox-icon.is-checked {
  background: #3370ff;
  border-color: #3370ff;
  color: #ffffff;
}

.lark-checkbox-icon.is-checked::after {
  content: '✓';
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.lark-amount-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.lark-add-row {
  cursor: pointer;
  transition: background 0.12s ease;
}

.lark-add-row:hover {
  background-color: #f0f4ff !important;
}

.lark-add-row td {
  color: #8f959e;
  font-size: 12px;
}

.lark-add-row:hover td {
  color: #3370ff;
}

.lark-row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid #dee0e3;
  background: #ffffff;
  color: #4e535c;
  cursor: pointer;
  transition: all 0.12s ease;
  line-height: 1.2;
}

.lark-row-action-btn:hover {
  background: #f2f3f5;
  color: #1f2329;
  border-color: #bbbfc4;
}

.lark-row-action-btn.btn-del {
  color: #dc2626;
  border-color: #fee2e2;
}

.lark-row-action-btn.btn-del:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

/* ==================== LARK BASE VIEW TABS & FILTER BAR ==================== */
.lark-view-bar-container {
  background: #ffffff;
  border: 1px solid #dee0e3;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.lark-view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #fcfcfd;
  border-bottom: 1px solid #ebebeb;
  gap: 12px;
  min-height: 42px;
  flex-wrap: wrap;
}

.lark-view-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  max-width: 100%;
  padding: 2px 0;
}

.lark-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  color: #646a73;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s ease;
  position: relative;
}

.lark-view-tab:hover {
  background: #f2f3f5;
  color: #1f2329;
}

.lark-view-tab.active {
  background: #e8f0ff;
  color: #3370ff;
  border-color: #c9ddff;
  font-weight: 600;
}

.lark-view-tab-icon {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  opacity: 0.8;
}

.lark-view-tab-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lark-view-tab-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  opacity: 0;
  font-size: 12px;
  line-height: 1;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.lark-view-tab:hover .lark-view-tab-menu-btn,
.lark-view-tab.active .lark-view-tab-menu-btn {
  opacity: 0.7;
}

.lark-view-tab-menu-btn:hover {
  opacity: 1 !important;
  background: rgba(0, 0, 0, 0.08);
  color: #1f2329;
}

.lark-view-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px dashed #c9cdd4;
  background: #ffffff;
  color: #646a73;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.lark-view-add-btn:hover {
  border-color: #3370ff;
  color: #3370ff;
  background: #eff6ff;
}

.lark-view-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lark-view-search-box {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
  border: 1px solid #dee0e3;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  transition: border-color 0.15s ease;
}

.lark-view-search-box:focus-within {
  border-color: #3370ff;
  box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.15);
}

.lark-view-search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 12px;
  color: #1f2329;
  width: 140px;
}

.lark-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #dee0e3;
  border-radius: 6px;
  background: #ffffff;
  color: #4e535c;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lark-view-btn:hover {
  background: #f2f3f5;
  color: #1f2329;
  border-color: #bbbfc4;
}

.lark-view-btn.active {
  background: #e8f0ff;
  color: #3370ff;
  border-color: #a8c7fa;
  font-weight: 600;
}

/* Thanh công cụ chuẩn Lark Base bên dưới tabs */
.lark-view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #ffffff;
  border-bottom: 1px solid #ebebeb;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
}

.lark-view-toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lark-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #dee0e3;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2329;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
  height: 32px;
  box-sizing: border-box;
}

.lark-toolbar-btn:hover {
  background: #f2f3f5;
  color: #1f2329;
  border-color: #bbbfc4;
}

.lark-toolbar-btn.active {
  background: #e8f0ff;
  color: #3370ff;
  border-color: #a8c7fa;
  font-weight: 600;
}

.lark-toolbar-btn-add {
  background: #3370ff;
  color: #ffffff;
  border-color: #3370ff;
  font-weight: 600;
}

.lark-toolbar-btn-add:hover {
  background: #2860e1;
  border-color: #2860e1;
  color: #ffffff;
}

.lark-filter-badge {
  background: #3370ff;
  color: #ffffff;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  line-height: 1.2;
  margin-left: 3px;
}

/* Wrapper định vị Popover Lọc chuẩn Lark Base */
.lark-filter-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.lark-filter-panel {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 540px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border: 1px solid #dee0e3;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 35, 41, 0.12), 0 2px 6px rgba(31, 35, 41, 0.04);
  padding: 14px 16px;
  z-index: 1050;
  flex-direction: column;
  gap: 10px;
  animation: larkFadeDown 0.15s ease;
  box-sizing: border-box;
}

.lark-filter-panel.open {
  display: flex;
}

@keyframes larkFadeDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Popover Header */
.lark-filter-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #f2f3f5;
}

.lark-filter-popover-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #1f2329;
}

.lark-filter-info-icon {
  font-size: 13px;
  color: #8f959e;
  cursor: help;
}

.lark-filter-mini-select {
  padding: 2px 6px;
  font-size: 12px;
  border: 1px solid #dee0e3;
  border-radius: 4px;
  background: #fff;
  color: #1f2329;
  outline: none;
}

.lark-filter-conditions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 0;
}

/* Điều kiện lọc: 1 HÀNG DUY NHẤT, KHÔNG WRAP XUỐNG DÒNG */
.lark-filter-condition-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap !important;
  width: 100%;
  box-sizing: border-box;
}

.lark-filter-select,
.lark-filter-input {
  height: 32px;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid #dee0e3;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2329;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.lark-filter-select {
  cursor: pointer;
}

.lark-filter-select:focus,
.lark-filter-input:focus {
  border-color: #3370ff;
  box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.15);
}

.lark-filter-condition-row .filter-field-select {
  width: 135px;
  min-width: 120px;
  flex-shrink: 0;
}

.lark-filter-condition-row .filter-op-select {
  width: 105px;
  min-width: 95px;
  flex-shrink: 0;
}

.lark-filter-condition-row .filter-date-modifier {
  width: 110px;
  min-width: 100px;
  flex-shrink: 0;
}

.lark-filter-condition-row .filter-val-input,
.lark-filter-condition-row .filter-val-select {
  flex: 1;
  min-width: 110px;
  box-sizing: border-box;
}

.lark-filter-del-btn {
  background: transparent;
  border: none;
  color: #8f959e;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.lark-filter-del-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.lark-filter-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f2f3f5;
  border: none;
  color: #1f2329;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s ease, color 0.15s ease;
}

.lark-filter-add-btn:hover {
  background: #e5e6eb;
  color: #3370ff;
}

.lark-filter-ai-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f5f6f7;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 4px;
}

.lark-filter-ai-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  color: #1f2329;
}

.lark-filter-ai-bar input::placeholder {
  color: #8f959e;
}

.lark-filter-ai-send {
  background: transparent;
  border: none;
  color: #3370ff;
  cursor: pointer;
  padding: 2px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: transform 0.15s ease;
}

.lark-filter-ai-send:hover {
  transform: scale(1.15);
}

.lark-filter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid #f2f3f5;
}

.lark-view-btn-ghost {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 12px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.lark-view-btn-ghost:hover {
  background: #f2f3f5;
  color: #1f2329;
}

.lark-view-btn-secondary {
  background: #f2f3f5;
  border: 1px solid #dee0e3;
  color: #1f2329;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lark-view-btn-secondary:hover {
  background: #e5e6eb;
}

.lark-view-btn-primary {
  background: #3370ff;
  border: 1px solid #3370ff;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lark-view-btn-primary:hover {
  background: #2860e1;
}

.lark-view-dropdown-menu {
  position: absolute;
  background: #ffffff;
  border: 1px solid #dee0e3;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 4px 0;
  min-width: 150px;
  z-index: 1050;
  display: none;
}

.lark-view-dropdown-menu.show {
  display: block;
}

.lark-view-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: #1f2329;
  cursor: pointer;
  transition: background 0.12s ease;
}

.lark-view-dropdown-item:hover {
  background: #f2f3f5;
}

.lark-view-dropdown-item.danger {
  color: #dc2626;
}

.lark-view-dropdown-item.danger:hover {
  background: #fef2f2;
}

/* ==================== KHOẢN CHI (DAILY EXPENSE ENTRY) ==================== */
@media (max-width: 900px) {
  .expense-entry-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   MODERN CUSTOM VARIABLE MODAL (CHÈN BIẾN ĐỘNG TỪ BẢNG DỮ LIỆU)
   ========================================================================== */
dialog#flowCustomVarDialog.custom-var-modal {
  max-width: min(740px, calc(100vw - 32px));
  width: 740px;
  padding: 0;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #1e293b;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

dialog#flowCustomVarDialog.custom-var-modal::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.custom-var-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
}

.custom-var-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-var-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  border: 1px solid #c7d2fe;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.12);
}

.custom-var-modal-title {
  font-size: 1.12rem;
  font-weight: 750;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.custom-var-modal-subtitle {
  font-size: 0.78rem;
  color: #64748b;
  margin: 2px 0 0;
}

.custom-var-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.custom-var-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
  transform: scale(1.05);
}

.custom-var-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(85vh - 130px);
  overflow-y: auto;
}

.custom-var-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.custom-var-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.custom-var-input-group label {
  font-size: 0.76rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
  display: block;
}

.custom-var-select, .custom-var-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.82rem;
  background: #ffffff;
  color: #0f172a;
  transition: all 0.15s ease;
  outline: none;
  font-family: inherit;
}

.custom-var-select:focus, .custom-var-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.var-cond-empty-box {
  background: #ffffff;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.5;
}

.var-cond-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.15s ease;
}

.var-cond-row:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.var-cond-controls {
  display: grid;
  grid-template-columns: 2fr 1.5fr 2fr auto;
  gap: 8px;
  align-items: center;
}

.var-cond-del-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.var-cond-del-btn:hover {
  background: #fee2e2;
  border-color: #ef4444;
  transform: scale(1.05);
}

.var-cond-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-top: 2px;
}

.var-cond-preset-btn {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.var-cond-preset-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.var-cond-preset-btn.active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
  font-weight: 600;
}

/* Preview Card */
.custom-var-preview-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.05);
}

.custom-var-preview-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-var-preview-val-box {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.custom-var-big-result {
  font-size: 1.35rem;
  font-weight: 800;
  color: #15803d;
  font-family: inherit;
  line-height: 1;
}

.custom-var-match-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.custom-var-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  border-radius: 8px;
  padding: 8px 12px;
  gap: 10px;
}

.custom-var-code-box code {
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  word-break: break-all;
  font-weight: 600;
}

.custom-var-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}

/* Care Date Presets & Auto Toggle */
.care-date-presets-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin-top: 0;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.care-date-presets-bar::-webkit-scrollbar {
  display: none;
}

.care-date-preset-btn {
  flex: 0 0 auto;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #475569;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  height: 26px;
  padding: 0 7px;
  line-height: 24px;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.care-date-preset-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.care-date-preset-btn.active {
  background: #15803d !important;
  border-color: #166534 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(22, 101, 52, 0.35);
}

.care-custom-preset-wrap {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  height: 26px;
  padding: 0 5px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-sizing: border-box;
}

.care-custom-preset-wrap:hover {
  border-color: #94a3b8;
}

.care-custom-preset-wrap.active {
  background: #15803d !important;
  border-color: #166534 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(22, 101, 52, 0.35);
}

.care-custom-preset-wrap span {
  color: #475569;
  font-weight: 700;
  font-size: 0.8rem;
  pointer-events: none;
}

.care-custom-preset-wrap.active span {
  color: #ffffff !important;
}

.care-custom-preset-wrap input {
  width: 28px;
  height: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  color: #15803d;
  background: #ffffff;
  outline: none;
  margin: 0;
  box-sizing: border-box;
}

.care-custom-preset-wrap.active input {
  border-color: #ffffff;
  color: #15803d;
  font-weight: 800;
}

.care-auto-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #15803d;
  cursor: pointer;
  user-select: none;
}
.care-helper-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.care-follow-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #16a34a;
  cursor: pointer;
  user-select: none;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  transition: all 0.15s ease;
}
.care-follow-toggle-wrap:hover {
  background: #dcfce7;
  border-color: #86efac;
}
.care-follow-toggle-wrap.is-unfollowed {
  color: #64748b;
  background: #f1f5f9;
  border-color: #cbd5e1;
  font-weight: 500;
}
.care-follow-toggle-wrap.is-unfollowed:hover {
  background: #e2e8f0;
}
.care-follow-checkbox {
  accent-color: #16a34a;
  cursor: pointer;
  width: 15px;
  height: 15px;
  margin: 0;
}

.care-auto-toggle-wrap input[type="checkbox"] {
  accent-color: #15803d;
  cursor: pointer;
  width: 14px;
  height: 14px;
  margin: 0;
}

#dashboardPanel.dashboard-panel-offscreen {
  position: absolute !important;
  left: -99999px !important;
  top: 0 !important;
  width: 100% !important;
  height: min(78dvh, 900px) !important;
  overflow: hidden !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.lark-dashboard-frame-wrap iframe.iframe-offscreen {
  position: absolute !important;
  left: -99999px !important;
  top: 0 !important;
  width: 100% !important;
  height: calc(100% + 50px) !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
