:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-muted: #eef1f5;
  --ink: #1a1f2e;
  --muted: #5a6378;
  --line: #d8dde8;
  --accent: #4A5A8F;
  --accent-strong: #3a4a7f;
  --accent-light: #6b8dd8;
  --accent-gradient: linear-gradient(135deg, #4A5A8F 0%, #5B7AC0 100%);
  --secondary: #5B9FD8;
  --secondary-light: #7EC8E3;
  --danger: #bd2f35;
  --warning: #a66509;
  --success: #277548;
  --sidebar: #2D3561;
  --sidebar-muted: #a8b5d1;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* Preview-only navigation groups use the same formal sidebar palette. */
.nav-group-title { margin: 12px 8px 3px; color: var(--sidebar-muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.nav-group-title:first-child { margin-top: 0; }

.brand-mark { display: grid; place-items: center; background: #fff; }
.brand-logo { display: block; width: 100%; height: 100%; object-fit: cover; }
.topbar-full-logo { display: block; width: 168px; height: auto; max-height: 42px; object-fit: contain; }
.intervention-rule-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.intervention-rule-toolbar h3 { margin: 3px 0 0; color: var(--sidebar); font-size: 18px; }
.intervention-pending-section { margin: 18px 0; padding: 14px; border: 1px solid #e3c98f; border-radius: 7px; background: #fffaf0; }
.intervention-pending-section .section-heading { min-height: 0; padding: 0 0 12px; border-bottom: 1px solid #eadcb9; }
.intervention-rule-card.pending { border-left: 3px solid var(--warning); }
.intervention-rule-actions { display: flex; gap: 8px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); }
@media (max-width: 680px) { .intervention-rule-toolbar { align-items: stretch; flex-direction: column; } }

/* Final brand overrides. Keep this block last so the legacy layout rules above
   remain compatible while the local preview consistently uses the new palette. */
:root {
  --bg: #f3f6f2;
  --surface-muted: #edf3ee;
  --ink: #19332c;
  --muted: #667873;
  --line: #d8e3dd;
  --accent: #2f8766;
  --accent-strong: #1e6f56;
  --secondary: #0b6659;
  --secondary-light: #9dd1bc;
  --danger: #b9494d;
  --warning: #9b6a21;
  --success: #287b59;
  --sidebar: #075e54;
  --sidebar-muted: #b8d4c8;
}
body { background: var(--bg); color: var(--ink); }
.login-screen { background: #e8f0eb; }
.login-panel { width: min(100%, 410px); padding: 38px; border-color: #cbded3; border-radius: 10px; box-shadow: 0 24px 70px rgba(7, 94, 84, .14); }
.login-panel .brand-mark { width: 84px; height: 84px; margin-bottom: 26px; border-radius: 50%; }
.login-panel h1 { color: var(--sidebar); font-size: 24px; letter-spacing: .01em; }
.login-panel > p { color: #71827b; }
.brand-mark { width: 40px; height: 40px; flex-basis: 40px; overflow: hidden; border-radius: 50%; background: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .16); }
.brand-logo { display: block; width: 100%; height: 100%; object-fit: cover; }
.app-shell { grid-template-columns: 242px minmax(0, 1fr); }
.sidebar { background: var(--sidebar); padding: 22px 15px; }
.brand { gap: 12px; padding: 0 9px 25px; border-bottom-color: rgba(184, 212, 200, .2); }
.brand strong { color: #f5fbf7; font-size: 16px; letter-spacing: .02em; }
.brand span { color: var(--sidebar-muted); }
nav { gap: 5px; margin-top: 20px; }
.nav-item { height: 44px; border-radius: 7px; color: #c4dcd1; font-weight: 600; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 3px 0 0 #a6d8be; }
.nav-symbol { border-color: rgba(184, 212, 200, .42); border-radius: 50%; }
.nav-item.active .nav-symbol { border-color: #b6dfca; color: #e3f5e9; background: rgba(166, 216, 190, .2); }
.sidebar-footer { border-top-color: rgba(184, 212, 200, .2); }
.quiet-command { color: #d5e9df; }
main { background: var(--bg); }
.topbar { height: 92px; padding: 0 34px; background: rgba(255,255,255,.92); border-bottom-color: var(--line); }
.eyebrow { color: var(--accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.topbar h2 { color: var(--sidebar); font-size: 22px; letter-spacing: -.01em; }
.icon-command { border-color: #c7d9d0; border-radius: 50%; color: var(--secondary); }
.icon-command:hover { border-color: var(--accent); background: #edf7f0; color: var(--accent-strong); }
.view { padding: 30px 34px 46px; }
.metric-band, .data-section, .qiwe-account-panel, .proactive-config-panel, .intervention-inbox-summary, .intervention-inbox-layout, .history-workspace, .qiwe-management-workspace { border-color: var(--line); border-radius: 9px; box-shadow: 0 8px 26px rgba(21, 67, 52, .055); }
.metric { min-height: 112px; padding: 23px; }
.metric span { color: var(--muted); font-weight: 600; }
.metric strong { color: var(--sidebar); font-size: 30px; }
.section-heading { min-height: 72px; padding: 14px 20px; }
.section-heading p { color: var(--accent); font-weight: 700; }
.section-heading h3, .dialog-head h3 { color: var(--sidebar); font-size: 16px; }
input, select, textarea { border-color: #c6d8cf; border-radius: 7px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 135, 102, .14); }
.primary-command { border-radius: 7px; background: var(--accent); }
.primary-command:hover { background: var(--accent-strong); }
.row-command, .primary-inline-command { border-radius: 6px; }
.status { border-radius: 999px; font-weight: 800; }
.qiwe-account-picker { padding: 20px; background: #f7faf7; border-right-color: var(--line); }
.qiwe-account-identity strong, .qiwe-account-metrics strong { color: var(--sidebar); }
.qiwe-management-workspace .qiwe-contact-table-wrap { border-right-color: var(--line); }
.qiwe-management-workspace .qiwe-contact-table thead th { background: #f5f9f6; box-shadow: 0 1px 0 var(--line); }
.qiwe-contact-table tbody tr[data-contact-id].selected { box-shadow: inset 3px 0 0 var(--accent); background: #edf7f1; }
.qiwe-contact-table tbody tr[data-contact-id]:hover { background: #f5faf7; }
.qiwe-inline-conversation { background: #fbfdfb; }
.qiwe-chat-toolbar { background: #f6faf7; border-bottom-color: var(--line); }
.qiwe-message-scroll, .intervention-message-list { background: #edf3ef; }
.qiwe-message-bubble { border-color: #d3e1da; box-shadow: 0 2px 5px rgba(21, 67, 52, .035); }
.qiwe-message-row.ai .qiwe-message-bubble { border-color: #a7d4bc; background: #e4f4eb; }
.qiwe-message-row.human .qiwe-message-bubble { border-color: #afd2cc; background: #e4f2f0; }
.qiwe-message-row.patient .qiwe-message-bubble { background: #fff; }
.qiwe-conversation-composer, .intervention-reply-form { background: #fff; border-top-color: var(--line); }
.intervention-event-list { background: #f5f9f6; border-right-color: var(--line); }
.intervention-event:hover { background: #edf7f1; }
.intervention-event.selected { box-shadow: inset 3px 0 0 var(--accent); background: #e4f3eb; }
.intervention-trigger { border-left-color: var(--accent); background: #f0f8f3; }
.history-list-item.selected { border-left-color: var(--accent); background: #edf7f1; }
.history-detail { background: #f5f9f6; }
.history-message-row.human_agent .history-message-bubble { border-color: #a8d5c0; background: #e4f4eb; }
.toast { border: 1px solid rgba(255,255,255,.2); border-radius: 7px; background: #075e54; }
.preview-ribbon { position: fixed; right: 18px; bottom: 18px; z-index: 20; padding: 8px 11px; border: 1px solid #b8d9c5; border-radius: 999px; background: #eff9f2; color: #23694c; box-shadow: 0 8px 24px rgba(21, 67, 52, .12); font-size: 11px; font-weight: 800; }

@media (max-width: 980px) {
  .topbar, .view { padding-left: 24px; padding-right: 24px; }
  .topbar-full-logo { width: 132px; max-height: 34px; }
}

/* Preview additions, kept after the formal theme so they inherit its colors. */
.brand-mark { display: grid; place-items: center; background: #fff; }
.brand-logo { display: block; width: 100%; height: 100%; object-fit: cover; }
.intervention-rule-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.intervention-rule-toolbar h3 { margin: 3px 0 0; color: var(--sidebar); font-size: 18px; }
.intervention-pending-section { margin: 18px 0; padding: 14px; border: 1px solid #e3c98f; border-radius: 7px; background: #fffaf0; }
.intervention-pending-section .section-heading { min-height: 0; padding: 0 0 12px; border-bottom: 1px solid #eadcb9; }
.intervention-rule-card.pending { border-left: 3px solid var(--warning); }
.intervention-rule-actions { display: flex; gap: 8px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); }
@media (max-width: 680px) { .intervention-rule-toolbar { align-items: stretch; flex-direction: column; } }

/* SupremeLife visual layer: quiet clinical green, editorial spacing, and a stronger
   workspace hierarchy while keeping the existing DOM and API-driven renderers. */
:root {
  --bg: #f3f6f2;
  --surface: #ffffff;
  --surface-muted: #edf3ee;
  --ink: #19332c;
  --muted: #667873;
  --line: #d8e3dd;
  --accent: #2f8766;
  --accent-strong: #1e6f56;
  --accent-light: #75b492;
  --accent-gradient: none;
  --secondary: #0b6659;
  --secondary-light: #9dd1bc;
  --danger: #b9494d;
  --warning: #9b6a21;
  --success: #287b59;
  --sidebar: #075e54;
  --sidebar-muted: #b8d4c8;
}

body { background: var(--bg); color: var(--ink); }
.login-screen { background: #e8f0eb; }
.login-panel { width: min(100%, 410px); padding: 38px; border-color: #cbded3; border-radius: 10px; box-shadow: 0 24px 70px rgba(7, 94, 84, .14); }
.login-panel .brand-mark { width: 84px; height: 84px; margin-bottom: 26px; border-radius: 50%; }
.login-panel h1 { color: var(--sidebar); font-size: 24px; letter-spacing: .01em; }
.login-panel > p { color: #71827b; }
.brand-mark { width: 40px; height: 40px; flex-basis: 40px; overflow: hidden; border-radius: 50%; background: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .16); }
.brand-logo { display: block; width: 100%; height: 100%; object-fit: cover; }
.app-shell { grid-template-columns: 242px minmax(0, 1fr); }
.sidebar { background: var(--sidebar); padding: 22px 15px; }
.brand { gap: 12px; padding: 0 9px 25px; border-bottom-color: rgba(184, 212, 200, .2); }
.brand strong { color: #f5fbf7; font-size: 16px; letter-spacing: .02em; }
.brand span { color: var(--sidebar-muted); }
nav { gap: 5px; margin-top: 20px; }
.nav-item { height: 44px; border-radius: 7px; color: #c4dcd1; font-weight: 600; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 3px 0 0 #a6d8be; }
.nav-symbol { border-color: rgba(184, 212, 200, .42); border-radius: 50%; }
.nav-item.active .nav-symbol { border-color: #b6dfca; color: #e3f5e9; background: rgba(166, 216, 190, .2); }
.sidebar-footer { border-top-color: rgba(184, 212, 200, .2); }
.quiet-command { color: #d5e9df; }
main { background: var(--bg); }
.topbar { height: 92px; padding: 0 34px; background: rgba(255,255,255,.92); border-bottom-color: var(--line); }
.eyebrow { color: var(--accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.topbar h2 { color: var(--sidebar); font-size: 22px; letter-spacing: -.01em; }
.connection-status { color: var(--success); }
.icon-command { border-color: #c7d9d0; border-radius: 50%; color: var(--secondary); }
.icon-command:hover { border-color: var(--accent); background: #edf7f0; color: var(--accent-strong); }
.view { padding: 30px 34px 46px; }
.metric-band { border-color: var(--line); border-radius: 9px; box-shadow: 0 8px 24px rgba(21, 67, 52, .05); }
.metric { min-height: 112px; padding: 23px; }
.metric span { color: var(--muted); font-weight: 600; }
.metric strong { color: var(--sidebar); font-size: 30px; }
.metric.alert strong { color: var(--danger); }
.section-grid { gap: 22px; margin-top: 22px; }
.data-section, .qiwe-account-panel, .proactive-config-panel, .intervention-inbox-summary, .intervention-inbox-layout, .history-workspace { border-color: var(--line); border-radius: 9px; box-shadow: 0 7px 24px rgba(21, 67, 52, .045); }
.section-heading { min-height: 72px; padding: 14px 20px; }
.section-heading p { color: var(--accent); font-weight: 700; }
.section-heading h3, .dialog-head h3 { color: var(--sidebar); font-size: 16px; }
.text-command { color: var(--accent-strong); }
input, select, textarea { border-color: #c6d8cf; border-radius: 7px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 135, 102, .14); }
.primary-command { border-radius: 7px; background: var(--accent); }
.primary-command:hover { background: var(--accent-strong); }
.row-command, .primary-inline-command { border-radius: 6px; }
.status { border-radius: 999px; font-weight: 800; }
.qiwe-account-panel { background: #fff; }
.qiwe-account-picker { padding: 20px; background: #f7faf7; border-right-color: var(--line); }
.qiwe-account-picker > span, .qiwe-account-identity span, .qiwe-account-metrics span { color: var(--muted); }
.qiwe-account-identity strong, .qiwe-account-metrics strong { color: var(--sidebar); }
.qiwe-account-metrics > div { border-left-color: var(--line); }
.qiwe-management-workspace { border-color: var(--line); border-radius: 9px; box-shadow: 0 8px 28px rgba(21, 67, 52, .06); }
.qiwe-management-workspace .qiwe-contact-table-wrap { border-right-color: var(--line); }
.qiwe-management-workspace .qiwe-contact-table thead th { background: #f5f9f6; box-shadow: 0 1px 0 var(--line); }
.qiwe-contact-table tbody tr[data-contact-id].selected { box-shadow: inset 3px 0 0 var(--accent); background: #edf7f1; }
.qiwe-contact-table tbody tr[data-contact-id]:hover { background: #f5faf7; }
.qiwe-inline-conversation { background: #fbfdfb; }
.qiwe-chat-toolbar { background: #f6faf7; border-bottom-color: var(--line); }
.qiwe-message-scroll, .intervention-message-list { background: #edf3ef; }
.qiwe-message-bubble { border-color: #d3e1da; box-shadow: 0 2px 5px rgba(21, 67, 52, .035); }
.qiwe-message-row.ai .qiwe-message-bubble { border-color: #a7d4bc; background: #e4f4eb; }
.qiwe-message-row.human .qiwe-message-bubble { border-color: #afd2cc; background: #e4f2f0; }
.qiwe-message-row.patient .qiwe-message-bubble { background: #fff; }
.qiwe-conversation-composer { background: #fff; border-top-color: var(--line); }
.intervention-event-list { background: #f5f9f6; border-right-color: var(--line); }
.intervention-event:hover { background: #edf7f1; }
.intervention-event.selected { box-shadow: inset 3px 0 0 var(--accent); background: #e4f3eb; }
.intervention-event.urgent { box-shadow: inset 3px 0 0 var(--danger); }
.intervention-detail-head { background: #fff; border-bottom-color: var(--line); }
.intervention-trigger { border-left-color: var(--accent); background: #f0f8f3; }
.intervention-reply-form { background: #fff; border-top-color: var(--line); }
.history-list-item.selected { border-left-color: var(--accent); background: #edf7f1; }
.history-detail { background: #f5f9f6; }
.history-detail-head { background: rgba(255,255,255,.96); border-bottom-color: var(--line); }
.history-message-bubble { border-color: #d4e1db; }
.history-message-row.human_agent .history-message-bubble { border-color: #a8d5c0; background: #e4f4eb; }
.history-message-row.ai_assistant .history-message-bubble { border-color: #e0c995; background: #fff7e5; }
.toast { border: 1px solid rgba(255,255,255,.2); border-radius: 7px; background: #075e54; }

@media (max-width: 980px) {
  .topbar, .view { padding-left: 24px; padding-right: 24px; }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; letter-spacing: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #e8ecf5 0%, #f0f3f8 100%); }
.login-panel { width: min(100%, 360px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 32px; box-shadow: 0 18px 50px rgba(45, 53, 97, .15); }
.login-panel .brand-mark { margin-bottom: 24px; }
.login-panel h1 { margin: 0 0 6px; font-size: 22px; color: var(--sidebar); }
.login-panel > p { margin: 0 0 28px; color: var(--muted); }
.login-panel label { display: block; margin: 16px 0; }
.login-panel label span { display: block; margin-bottom: 7px; color: #2d3548; font-weight: 600; }
input, select { width: 100%; height: 40px; border: 1px solid #c5cede; border-radius: 6px; background: #fff; color: var(--ink); padding: 0 11px; outline: none; }
textarea { width: 100%; min-height: 96px; resize: vertical; border: 1px solid #c5cede; border-radius: 6px; background: #fff; color: var(--ink); padding: 10px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 90, 143, .12); }
.primary-command { width: 100%; height: 42px; margin-top: 10px; border: 0; border-radius: 6px; background: var(--accent); color: white; font-weight: 700; }
.primary-command:hover { background: var(--accent-strong); }
.form-error { min-height: 20px; margin-top: 12px; color: var(--danger); font-size: 13px; }

.app-shell { min-height: 100vh; grid-template-columns: 224px minmax(0, 1fr); }
.app-shell:not([hidden]) { display: grid; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); color: #fff; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px; border-radius: 8px; background: linear-gradient(135deg, #5B9FD8 0%, #7EC8E3 100%); color: #fff; font-weight: 800; box-shadow: 0 4px 12px rgba(91, 159, 216, .3); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; }
.brand span { margin-top: 2px; color: var(--sidebar-muted); font-size: 12px; }
nav { display: grid; gap: 4px; margin-top: 18px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; border: 0; border-radius: 6px; background: transparent; color: #c9d4e0; padding: 0 11px; text-align: left; transition: all .15s ease; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(91, 159, 216, .18); color: #fff; box-shadow: inset 3px 0 0 var(--secondary); }
.nav-symbol { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid #5a6c8a; border-radius: 5px; font-size: 11px; }
.nav-item.active .nav-symbol { border-color: var(--secondary-light); color: #a8d5ee; background: rgba(126, 200, 227, .12); }
.nav-unread-dot { width: 8px; height: 8px; margin-left: auto; flex: 0 0 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px rgba(235, 91, 87, .18); }
.sidebar-footer { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; justify-content: space-between; color: var(--sidebar-muted); font-size: 12px; }
.quiet-command { border: 0; background: transparent; color: #d8e5f0; padding: 6px; transition: color .15s ease; }
.quiet-command:hover { color: #fff; }

main { min-width: 0; }
.topbar { height: 86px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; background: var(--surface); border-bottom: 1px solid var(--line); }
.eyebrow, .section-heading p, .dialog-head p { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.topbar h2 { margin: 0; font-size: 20px; color: var(--sidebar); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection-status { display: inline-flex; align-items: center; gap: 7px; color: var(--success); font-size: 12px; font-weight: 700; }
.connection-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(39,117,72,.12); }
.icon-command { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #4a5466; font-size: 19px; transition: all .15s ease; }
.icon-command:hover { border-color: var(--accent); background: #f8f9fb; color: var(--accent); }

.view { display: none; padding: 26px 30px 40px; }
.view.active { display: block; }
.metric-band { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.metric { min-height: 104px; padding: 21px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 10px; font-size: 28px; line-height: 1; color: var(--sidebar); }
.metric.alert strong { color: var(--danger); }
.section-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; margin-top: 20px; }
.data-section { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.section-heading { min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.section-heading h3, .dialog-head h3 { margin: 0; font-size: 15px; color: var(--sidebar); }
.text-command { border: 0; background: transparent; color: var(--accent); font-weight: 700; padding: 7px; transition: color .15s ease; }
.text-command:hover { color: var(--accent-strong); }

.table-toolbar { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.filter-group { display: flex; gap: 8px; }
.filter-group select { width: 150px; }
.result-count { color: var(--muted); font-size: 12px; }
.toolbar-actions { display: flex; align-items: center; gap: 12px; }
.qiwe-account-panel { min-height: 104px; display: grid; grid-template-columns: minmax(210px, 260px) minmax(0, 1fr); margin-bottom: 18px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.qiwe-account-picker { display: grid; align-content: center; gap: 8px; padding: 18px; border-right: 1px solid var(--line); }
.qiwe-account-picker > span, .qiwe-account-identity span, .qiwe-account-metrics span { color: var(--muted); font-size: 11px; font-weight: 700; }
.qiwe-account-summary { min-width: 0; display: grid; grid-template-columns: minmax(150px, .62fr) minmax(280px, 1.38fr); }
.qiwe-account-notice { grid-column: 1 / -1; min-height: 102px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; color: var(--muted); }
.qiwe-account-identity { min-width: 0; display: grid; align-content: center; gap: 8px; padding: 16px 18px; }
.qiwe-account-identity strong { display: block; margin-top: 4px; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; color: var(--sidebar); }
.qiwe-account-identity small { color: var(--muted); font-size: 10px; }
.qiwe-account-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.qiwe-account-features { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.qiwe-account-bulk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.qiwe-account-bulk-actions .row-command { color: var(--danger); border-color: #e2c3c3; }
.qiwe-account-bulk-actions .row-command:hover:not(:disabled) { background: #fff3f3; border-color: #c99797; }
.qiwe-account-feature { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 700; }
.qiwe-account-feature > span:first-child { color: var(--ink); font-size: 12px; }
.qiwe-account-metrics { min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(80px, 1fr)); }
.qiwe-account-metrics > div { min-width: 0; display: grid; align-content: center; gap: 7px; padding: 14px; border-left: 1px solid var(--line); }
.qiwe-account-metrics strong { font-size: 20px; line-height: 1.15; color: var(--sidebar); }
.qiwe-account-metrics .qiwe-account-time { font-size: 12px; line-height: 1.4; white-space: nowrap; }
.qiwe-contact-toolbar { align-items: end; }
.qiwe-contact-search { width: min(100%, 720px); display: grid; grid-template-columns: minmax(240px, 1fr) 150px 168px; align-items: center; gap: 8px; }
.qiwe-contact-search .result-count { grid-column: 1 / -1; min-height: 18px; }
.proactive-followup-toolbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.proactive-image-policy-status { min-height: 30px; display: inline-flex; align-items: center; padding: 0 9px; border: 1px solid #cbd5d7; border-radius: 4px; background: #f7faf9; color: #526065; font-size: 11px; font-weight: 700; white-space: nowrap; }
.proactive-select-cell input, .proactive-image-cell input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); vertical-align: middle; }
.proactive-image-dialog { width: min(760px, calc(100vw - 32px)); max-width: 760px; padding: 0; border: 0; border-radius: 10px; box-shadow: 0 22px 70px rgba(23, 43, 42, .24); color: var(--ink); }
.proactive-image-dialog::backdrop { background: rgba(22, 37, 36, .42); }
.proactive-image-dialog-body { padding: 0 20px 20px; }
.proactive-image-policy-card { display: grid; grid-template-columns: 1fr auto; gap: 14px 18px; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: #f7faf9; }
.proactive-image-policy-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.proactive-policy-switch { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 700; white-space: nowrap; }
.proactive-policy-switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.proactive-policy-dates { grid-column: 1 / -1; display: flex; align-items: end; gap: 10px; }
.proactive-policy-dates label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.proactive-policy-dates input { width: 160px; }
.proactive-prefix-toggle { grid-column: 1 / 2; }
.proactive-prefix-input { grid-column: 2 / 3; display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.proactive-prefix-input input { min-width: 240px; }
.proactive-image-dialog-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 18px 0 10px; }
.proactive-image-dialog-toolbar > div { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.proactive-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; min-height: 120px; }
.proactive-image-card { display: grid; grid-template-columns: auto 58px 1fr; align-items: center; gap: 9px; min-height: 76px; padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font-size: 12px; cursor: pointer; }
.proactive-image-card:has(input:checked) { border-color: var(--accent); background: #eef8f5; }
.proactive-image-card input { width: 17px; height: 17px; accent-color: var(--accent); }
.proactive-image-thumb { width: 58px; height: 58px; display: grid; place-items: center; overflow: hidden; border-radius: 5px; background: #e8efed; color: var(--muted); font-size: 11px; }
.proactive-image-thumb img { width: 100%; height: 100%; object-fit: cover; }
.proactive-followup-filters { display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; }
.proactive-followup-filters label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.proactive-followup-filters select { min-width: 150px; }
.proactive-date-filter { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.proactive-date-filter input { width: 154px; }
.proactive-date-range { min-height: 30px; display: inline-flex; align-items: center; padding: 0 9px; border: 1px solid #cbd5d7; border-radius: 4px; background: #fff; color: #526065; font-size: 11px; font-weight: 700; white-space: nowrap; }
.proactive-operation-result { min-height: 42px; display: flex; align-items: center; margin: -2px 0 12px; padding: 9px 12px; border: 1px solid #bfd8d2; border-radius: 5px; background: #edf7f4; color: #24675f; font-size: 12px; line-height: 1.5; }
.proactive-operation-result.warning { border-color: #e1c78e; background: #fff7e5; color: #805912; }
.proactive-operation-result.error { border-color: #e2c3c3; background: #fff3f3; color: #9f2f2f; }
.nutritionist-config-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.nutritionist-config-form { display: flex; align-items: end; gap: 8px; }
.nutritionist-config-form label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.nutritionist-config-form input { min-width: 180px; }
.nutritionist-config-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; color: var(--muted); font-size: 11px; }
.nutritionist-config-list span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; background: #f8fafa; color: var(--ink); }
.proactive-config-panel { margin-bottom: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.intervention-inbox-summary { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)); margin-bottom: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.intervention-inbox-summary > div { min-height: 78px; display: grid; align-content: center; gap: 7px; padding: 14px 17px; border-right: 1px solid var(--line); }
.intervention-inbox-summary > div:last-child { border-right: 0; }
.intervention-inbox-summary span { color: var(--muted); font-size: 11px; font-weight: 700; }
.intervention-inbox-summary strong { font-size: 22px; }
.intervention-toolbar-filters { display: flex; align-items: center; gap: 10px; }
.intervention-account-filter { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.intervention-account-filter select { width: 190px; }
.intervention-inbox-layout { min-height: 620px; display: grid; grid-template-columns: minmax(280px, .78fr) minmax(420px, 1.5fr); overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.intervention-event-list { max-height: 720px; overflow-y: auto; border-right: 1px solid var(--line); background: #f8fafa; }
.intervention-event { width: 100%; display: grid; gap: 7px; padding: 14px 15px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.intervention-event:hover { background: #f0f5f4; }
.intervention-event.selected { box-shadow: inset 3px 0 0 var(--accent); background: #e9f4f2; }
.intervention-event.urgent { box-shadow: inset 3px 0 0 var(--danger); }
.intervention-event.urgent.selected { background: #fff2f2; }
.intervention-event-head, .intervention-event-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.intervention-event-head strong { min-width: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.intervention-event-reason { color: #344348; font-size: 12px; font-weight: 700; }
.intervention-event-excerpt { overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }
.intervention-event-meta { color: var(--muted); font-size: 10px; }
.intervention-event-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.intervention-unread-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--danger); }
.qiwe-contact-cell { position: relative; }
.qiwe-unread-dot { position: absolute; top: 10px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px rgba(235, 91, 87, .18); }
.intervention-event-detail { min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.intervention-detail-head { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.intervention-detail-head > div:first-child { min-width: 0; }
.intervention-detail-head p { margin: 0 0 3px; color: var(--muted); font-size: 10px; }
.intervention-detail-head h3 { margin: 0 0 4px; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.intervention-detail-head span { color: var(--muted); font-size: 10px; }
.intervention-detail-actions { flex: 0 0 auto; }
.intervention-trigger { max-height: 220px; margin: 14px 18px 0; padding: 0; border-left: 3px solid var(--warning); background: #fff8e8; overflow: hidden; }
.intervention-trigger summary { min-height: 38px; display: flex; align-items: center; padding: 9px 12px; color: #364247; font-size: 11px; font-weight: 700; cursor: pointer; list-style-position: inside; }
.intervention-trigger summary::marker { color: var(--warning); }
.intervention-trigger-content { max-height: 162px; margin: 0 12px 10px; padding: 7px 10px; border: 1px solid #eadfbe; border-radius: 4px; color: #4c595d; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-y: auto; overflow-wrap: anywhere; background: rgba(255,255,255,.56); scrollbar-gutter: stable; }
.intervention-trigger:not([open]) { max-height: 40px; }
.intervention-message-list { height: min(48vh, 510px); min-height: 310px; display: flex; flex-direction: column; gap: 14px; margin-top: 14px; padding: 18px; overflow-y: auto; background: #f4f6f7; }
.intervention-reply-form { display: grid; gap: 8px; padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.intervention-reply-form textarea { min-height: 152px; max-height: 280px; }
.intervention-reply-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.intervention-reply-actions .form-error { margin: 0; }
.intervention-channel-warning { margin: 14px 18px 18px; padding: 11px 12px; border: 1px solid #e1c78e; border-radius: 5px; background: #fff7e5; color: #805912; font-size: 12px; }
.intervention-rule-summary { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.intervention-rule-summary > div { min-height: 78px; display: grid; align-content: center; gap: 7px; padding: 14px 17px; border-right: 1px solid var(--line); }
.intervention-rule-summary > div:last-child { border-right: 0; }
.intervention-rule-summary span { color: var(--muted); font-size: 11px; font-weight: 700; }
.intervention-rule-summary strong { font-size: 20px; }
.intervention-rule-summary > div:first-child strong { color: var(--success); font-size: 14px; }
.intervention-rule-note { margin: 14px 0; padding: 11px 13px; border-left: 3px solid var(--accent); background: #edf7f4; color: #315d57; font-size: 12px; line-height: 1.55; }
.intervention-rule-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.intervention-rule-card { min-width: 0; padding: 15px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.intervention-rule-card.urgent { border-left: 3px solid var(--danger); }
.intervention-rule-card.high { border-left: 3px solid var(--warning); }
.intervention-rule-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.intervention-rule-head span:first-child { color: var(--muted); font-size: 10px; font-weight: 700; }
.intervention-rule-head h3 { margin: 4px 0 0; font-size: 14px; }
.intervention-rule-card > p { min-height: 38px; margin: 12px 0; color: #48565a; font-size: 12px; line-height: 1.6; }
.intervention-rule-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.intervention-rule-examples span { padding: 5px 7px; border: 1px solid #d7e0e1; border-radius: 4px; background: #f7f9f9; color: #536166; font-size: 10px; }
.intervention-rule-handling { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.5; }
.intervention-rule-handling strong { color: var(--accent); }
.intervention-rule-handling span { color: var(--muted); }
.proactive-config-summary { display: grid; grid-template-columns: repeat(7, minmax(100px, 1fr)); }
.proactive-config-summary > div { min-width: 0; min-height: 78px; display: grid; align-content: center; gap: 7px; padding: 13px 15px; border-right: 1px solid var(--line); }
.proactive-config-summary > div:last-child { border-right: 0; }
.proactive-config-summary span, .proactive-send-time > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.proactive-config-summary strong { overflow: hidden; font-size: 13px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.proactive-config-summary strong.is-enabled { color: var(--success); }
.proactive-config-summary strong.is-disabled { color: var(--danger); }
.proactive-gate-summary small { overflow-wrap: anywhere; color: var(--muted); font-size: 9px; line-height: 1.35; }
.proactive-config-form { min-height: 74px; display: grid; grid-template-columns: minmax(150px, 190px) minmax(150px, 190px) minmax(150px, 1fr) auto; align-items: center; gap: 18px; padding: 13px 15px; border-top: 1px solid var(--line); background: #f8fafa; }
.proactive-send-time { display: grid; gap: 6px; }
.proactive-sending-control { display: flex; align-items: center; gap: 12px; width: fit-content; }
.proactive-sending-control > span:first-child { display: grid; gap: 3px; }
.proactive-sending-control strong { font-size: 12px; }
.proactive-sending-control small { color: var(--muted); font-size: 10px; }
.proactive-config-actions { display: flex; align-items: center; gap: 8px; }
.proactive-followup-table { min-width: 1280px; table-layout: fixed; }
.proactive-followup-table th:nth-child(1) { width: 5%; }
.proactive-followup-table th:nth-child(2) { width: 5%; }
.proactive-followup-table th:nth-child(3) { width: 10%; }
.proactive-followup-table th:nth-child(4) { width: 9%; }
.proactive-followup-table th:nth-child(5) { width: 12%; }
.proactive-followup-table th:nth-child(6) { width: 12%; }
.proactive-followup-table th:nth-child(7) { width: 8%; }
.proactive-followup-table th:nth-child(8) { width: 10%; }
.proactive-followup-table th:nth-child(9) { width: 11%; }
.proactive-followup-table th:nth-child(10) { width: 18%; min-width: 220px; }
.proactive-select-all { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.proactive-select-all input { width: 17px; height: 17px; accent-color: var(--accent); }
.proactive-select-cell input { width: 17px; height: 17px; accent-color: var(--accent); }
.proactive-mobile { white-space: nowrap; }
.proactive-send-account { margin-top: 3px; color: var(--muted); font-size: 10px; }
.proactive-send-state { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; margin-top: 5px; color: var(--danger); font-size: 10px; }
.proactive-message-preview { width: 100%; display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.proactive-detail-state strong { overflow-wrap: anywhere; }
.proactive-send-one { min-width: 78px; }
.proactive-row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 220px; }
.proactive-row-actions .row-command { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.proactive-message-edit-form { display: grid; gap: 2px; }
.connection-safety-note { display: grid; gap: 5px; padding: 12px 14px; border: 1px solid #c9ded9; border-radius: 6px; background: #eef7f5; }
.connection-safety-note strong { color: #24675f; font-size: 13px; }
.connection-safety-note span { color: #536166; font-size: 12px; line-height: 1.55; }
.qiwe-row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 146px; }
.danger-command { color: #9f2f2f; border-color: #e2c3c3; }
.danger-command:hover:not(:disabled) { background: #fff3f3; border-color: #c99797; }
.sync-command { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.sync-command span { font-size: 17px; line-height: 1; }
.sync-command.loading span { animation: sync-spin .8s linear infinite; }
@keyframes sync-spin { to { transform: rotate(360deg); } }
.monitoring-section + .monitoring-section { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.monitoring-section .table-toolbar h3 { margin: 2px 0 0; font-size: 15px; }
.section-kicker { margin: 0; color: var(--muted); font-size: 11px; }
.segmented { display: inline-flex; padding: 3px; background: #e5ebec; border-radius: 6px; }
.segmented button { height: 32px; border: 0; border-radius: 4px; padding: 0 14px; background: transparent; color: #536166; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20,35,38,.12); }
.scroll-segmented { max-width: 100%; overflow-x: auto; }
.scroll-segmented button { flex: 0 0 auto; }
.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e6ebec; text-align: left; vertical-align: middle; }
th { height: 43px; background: #f8f9fb; color: #5d696d; font-size: 11px; font-weight: 700; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f9fafb; }
.cell-title { font-weight: 700; color: #2d3548; }
.cell-subtitle { margin-top: 3px; color: var(--muted); font-size: 12px; }
.cell-clamp { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qiwe-contact-table { min-width: 620px; table-layout: fixed; }
.qiwe-contact-table th:nth-child(1) { width: 46%; }
.qiwe-contact-table th:nth-child(2), .qiwe-contact-table th:nth-child(3) { width: 16%; }
.qiwe-contact-table th:nth-child(4) { width: 22%; }
.qiwe-management-workspace { height: clamp(560px, calc(100vh - 340px), 820px); min-height: 0; display: grid; grid-template-columns: minmax(430px, .92fr) minmax(460px, 1.08fr); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.qiwe-management-workspace .qiwe-contact-table-wrap { min-width: 0; min-height: 0; border: 0; border-right: 1px solid var(--line); border-radius: 0; overflow-x: auto; overflow-y: scroll; overscroll-behavior: contain; scrollbar-gutter: stable; }
.qiwe-management-workspace .qiwe-contact-table thead th { position: sticky; top: 0; z-index: 2; background: #f8f9fb; box-shadow: 0 1px 0 var(--line); }
.qiwe-contact-table tbody tr[data-contact-id] { cursor: pointer; }
.qiwe-contact-table tbody tr[data-contact-id]:hover { background: #f3f7fa; }
.qiwe-contact-table tbody tr[data-contact-id].selected { box-shadow: inset 3px 0 0 var(--accent); background: #eef3f8; }
.qiwe-inline-conversation { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); }
.qiwe-inline-conversation .qiwe-conversation-overview { border-bottom: 1px solid var(--line); }
.qiwe-inline-conversation .qiwe-message-scroll { height: auto; min-height: 0; flex: 1 1 auto; overflow-y: scroll; overscroll-behavior: contain; scrollbar-gutter: stable; }
.qiwe-inline-conversation .qiwe-conversation-composer { margin-top: auto; }
.qiwe-inline-conversation .empty-state { margin: auto; }
.qiwe-chat-toolbar { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 14px; border-bottom: 1px solid var(--line); background: #f8f9fb; }
.qiwe-chat-toolbar .qiwe-earlier-bar { min-height: 0; padding: 0; border: 0; background: transparent; }
.contact-user-id { display: block; max-width: 100%; color: #4a5466; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.qiwe-contact-takeover { margin-top: 6px; }
.qiwe-reply-schedule { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.qiwe-reply-schedule > label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.qiwe-reply-schedule input[type="time"] { width: 100%; min-width: 0; height: 34px; padding: 0 8px; }
.qiwe-reply-schedule .qiwe-reply-schedule-toggle { min-height: 28px; display: flex; grid-column: 1 / -1; align-items: center; flex-direction: row; gap: 7px; color: var(--ink); font-size: 11px; }
.qiwe-reply-schedule .qiwe-reply-schedule-toggle input { width: 16px; height: 16px; }
.qiwe-reply-schedule > button, .qiwe-reply-schedule > small { grid-column: 1 / -1; }
.qiwe-reply-schedule > small { color: var(--muted); font-size: 10px; }
.qiwe-reply-schedule-readonly { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; }
.qiwe-reply-schedule-readonly span, .qiwe-reply-schedule-readonly small { color: var(--muted); }
.qiwe-contact-takeover .status { max-width: 100%; line-height: 1.35; }
.feature-switch { position: relative; width: 42px; height: 24px; display: inline-block; vertical-align: middle; }
.feature-switch input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.feature-switch span { position: absolute; inset: 0; border: 1px solid #b9c5d4; border-radius: 12px; background: #d5dde6; cursor: pointer; transition: background-color .16s ease, border-color .16s ease; }
.feature-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(45, 53, 97, .25); transition: transform .16s ease; }
.feature-switch input:checked + span { border-color: var(--accent); background: var(--accent); }
.feature-switch input:checked + span::after { transform: translateX(18px); }
.feature-switch input:focus-visible + span { outline: 3px solid rgba(74, 90, 143, .2); outline-offset: 2px; }
.feature-switch input:disabled + span { cursor: wait; opacity: .55; }
.row-command { border: 1px solid #c5cede; border-radius: 5px; background: #fff; color: #3a4456; padding: 6px 10px; white-space: nowrap; transition: all .15s ease; }
.row-command:hover { border-color: var(--accent); color: var(--accent); background: #f8f9fb; }
.review-summary { max-width: 420px; padding: 0; border: 0; background: transparent; color: var(--ink); font: inherit; line-height: 1.45; text-align: left; }
.review-summary:hover { color: var(--accent); }
.action-cluster { display: flex; gap: 6px; }
.primary-inline-command, .danger-command { min-height: 36px; border: 0; border-radius: 5px; padding: 7px 13px; color: #fff; font-weight: 700; white-space: nowrap; }
.primary-inline-command { background: var(--accent); }
.primary-inline-command:hover { background: var(--accent-strong); }
.danger-command { background: var(--danger); }
.danger-command:hover { background: #9f242a; }
.status { display: inline-flex; align-items: center; min-height: 24px; border-radius: 4px; padding: 3px 8px; font-size: 11px; font-weight: 700; background: #e8edee; color: #536166; }
.status.approved, .status.granted, .status.resolved, .status.active, .status.low, .status.succeeded, .status.sent { background: #e4f2e9; color: var(--success); }
.status.pending, .status.acknowledged, .status.high, .status.medium, .status.ready, .status.running, .status.generated, .status.scheduled, .status.sending, .status.draft_ready, .status.uncertain { background: #fff1d9; color: var(--warning); }
.status.human_takeover { background: #fff1d9; color: var(--warning); }
.status.human_pending { background: #ffe8e8; color: #b42318; }
.takeover-release-command { margin-left: 7px; padding: 2px 6px; border: 1px solid currentColor; border-radius: 3px; background: #fff; color: var(--warning); font: inherit; cursor: pointer; white-space: nowrap; }
.takeover-release-command:hover { background: #fff8e9; }
.takeover-complete-command { margin-left: 7px; padding: 2px 6px; border: 1px solid currentColor; border-radius: 3px; background: #fff; color: #b42318; font: inherit; cursor: pointer; white-space: nowrap; }
.takeover-complete-command:hover { background: #fff5f5; }
.takeover-complete-command:disabled { cursor: wait; opacity: .55; }
.takeover-release-command:disabled { cursor: wait; opacity: .55; }
.status.urgent, .status.open, .status.withdrawn, .status.paused, .status.failed, .status.blocked { background: #fbe5e6; color: var(--danger); }
.status.takeover_expired { background: #eceff0; color: #667378; }
.status.retired, .status.dismissed, .status.cancelled, .status.skipped, .status.no_data { background: #eceff0; color: #667378; }
.empty-state { padding: 34px 18px; color: var(--muted); text-align: center; }
.compact-list { padding: 4px 0; }
.compact-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 17px; border-bottom: 1px solid #e8eded; }
.compact-row:last-child { border-bottom: 0; }

.detail-dialog { width: min(920px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 24px 80px rgba(17,31,34,.24); }
.detail-dialog::backdrop { background: rgba(14, 25, 28, .48); }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 14px 18px; background: #fff; border-bottom: 1px solid var(--line); }
.dialog-body { max-height: calc(100vh - 114px); padding: 18px; overflow: auto; }
.qiwe-conversation-dialog { width: min(860px, calc(100vw - 28px)); }
.qiwe-conversation-dialog .dialog-body { padding: 0; overflow: hidden; }
.qiwe-conversation-overview { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 18px; background: #f8fafa; border-bottom: 1px solid var(--line); }
.qiwe-conversation-overview > div:first-child { min-width: 0; display: grid; gap: 3px; }
.qiwe-conversation-overview > div:first-child > span, .qiwe-conversation-overview small { color: var(--muted); font-size: 10px; }
.qiwe-conversation-overview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qiwe-conversation-overview small { max-width: 320px; overflow-wrap: anywhere; }
.qiwe-conversation-takeover { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; margin-top: 5px; }
.qiwe-conversation-takeover > span { color: var(--muted); font-size: 10px; }
.qiwe-conversation-takeover > strong { min-width: 0; overflow: visible; white-space: normal; }
.qiwe-message-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 12px; color: #526065; font-size: 10px; }
.qiwe-message-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.qiwe-message-legend i { width: 8px; height: 8px; border: 1px solid #c7d1d3; border-radius: 50%; background: #eef2f2; }
.qiwe-message-legend .ai i { border-color: #81bcb3; background: #b9e1da; }
.qiwe-message-legend .human i { border-color: #84aeca; background: #c9e1f0; }
.qiwe-message-legend .integration i { border-color: #d0a662; background: #f1d8a8; }
.qiwe-message-legend .unknown i { border-color: #aab2b4; background: #fff; }
.qiwe-earlier-bar { min-height: 46px; display: flex; align-items: center; justify-content: center; padding: 7px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.qiwe-earlier-bar > span { color: var(--muted); font-size: 10px; }
.qiwe-message-scroll { height: min(52vh, 520px); min-height: 300px; overflow-y: auto; background: #f4f6f7; }
.qiwe-message-list { min-height: 100%; display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.qiwe-message-row { width: fit-content; max-width: 78%; display: grid; gap: 5px; }
.qiwe-message-row.patient { align-self: flex-start; }
.qiwe-message-row.ai, .qiwe-message-row.human, .qiwe-message-row.integration, .qiwe-message-row.system { align-self: flex-end; }
.qiwe-message-row.unknown { align-self: center; max-width: 86%; }
.qiwe-message-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 3px; color: var(--muted); font-size: 10px; }
.qiwe-message-head strong { color: #48565a; font-size: 11px; }
.qiwe-message-bubble { min-width: 88px; padding: 10px 12px; border: 1px solid #d8e0e1; border-radius: 6px; background: #fff; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.qiwe-message-row.ai .qiwe-message-bubble { border-color: #aed7d0; background: #e3f3ef; }
.qiwe-message-row.human .qiwe-message-bubble { border-color: #b5d0e1; background: #e7f1f7; }
.qiwe-message-row.integration .qiwe-message-bubble { border-color: #e2c993; background: #fff5df; }
.qiwe-message-row.system .qiwe-message-bubble { border-color: #d7c4dc; background: #f4ebf6; }
.qiwe-message-row.unknown .qiwe-message-bubble { border-style: dashed; color: #59666a; background: #f9fafa; }
.qiwe-message-row.intervention-trigger-message .qiwe-message-bubble { border-color: #d94b4b; box-shadow: inset 4px 0 0 #c93636; background: #ffe3e3; color: #701f1f; }
.qiwe-message-row.intervention-trigger-message .qiwe-message-head strong { color: #a52d2d; }
.qiwe-message-media { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 7px; margin-bottom: 7px; }
.qiwe-message-media a { display: block; min-width: 120px; min-height: 90px; overflow: hidden; border: 1px solid #ccd6d8; border-radius: 5px; background: #eef2f2; }
.qiwe-message-media a.failed { display: none; }
.qiwe-message-media img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #fff; }
.qiwe-message-image-note { display: flex; align-items: center; gap: 7px; margin-top: 7px; color: #536166; font-size: 11px; }
.qiwe-message-image-note:first-child { margin-top: 0; }
.qiwe-conversation-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: #fff; }
.qiwe-conversation-composer textarea { min-height: 88px; max-height: 240px; resize: vertical; }
.qiwe-conversation-composer button { min-width: 72px; height: 44px; }
.qiwe-conversation-send-error { grid-column: 1 / -1; margin: 0; }
.qiwe-conversation-send-error:empty { display: none; }
.quick-reply-panel { grid-column: 1 / -1; border: 1px solid #d9e2de; border-radius: 6px; overflow: hidden; background: #fbfcfb; }
.quick-reply-panel > header { min-height: 42px; display: flex; align-items: center; gap: 12px; padding: 5px 8px; border-bottom: 1px solid #e3e9e6; background: #f5f8f6; }
.quick-reply-toggle { min-width: 0; border: 0; display: flex; align-items: center; gap: 9px; padding: 5px 7px; background: transparent; color: #293531; cursor: pointer; }
.quick-reply-toggle > span { min-width: 0; display: flex; align-items: baseline; gap: 7px; }
.quick-reply-toggle strong { font-size: 12px; white-space: nowrap; }
.quick-reply-toggle small, .quick-reply-hint span { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-reply-toggle i { color: var(--accent); font-style: normal; font-size: 14px; }
.quick-reply-hint { min-width: 0; flex: 1; }
.quick-reply-actions { display: flex; gap: 6px; }
.quick-reply-actions .row-command { padding: 4px 8px; font-size: 11px; }
.quick-reply-workspace { height: min(220px, 34vh); min-height: 200px; display: grid; grid-template-columns: minmax(220px, 34%) minmax(0, 1fr); }
.quick-reply-workspace > nav, .quick-reply-list { min-height: 0; overflow-y: auto; }
.quick-reply-workspace > nav { padding: 5px; border-right: 1px solid #e3e9e6; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 2px; background: #f7f9f8; }
.quick-reply-category-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 2px; }
.quick-reply-category-row > span { display: none; }
.quick-reply-template-label { color: #74817d; font-size: 9px; white-space: nowrap; }
.quick-reply-category { min-width: 0; border: 0; border-radius: 4px; padding: 5px 6px; background: transparent; color: #35413d; font-size: 11px; line-height: 1.25; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.quick-reply-panel .quick-reply-category { height: auto; min-height: 28px; }
.quick-reply-category:hover, .quick-reply-category.active { background: #e5ece8; color: #1f5145; }
.quick-reply-category-row .icon-command, .quick-reply-row .icon-command { width: 24px; min-width: 24px; height: 24px; font-size: 12px; }
.quick-reply-list { padding: 4px 9px; background: #fff; }
.quick-reply-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: start; gap: 3px; border-bottom: 1px solid #edf0ef; }
.quick-reply-row:last-child { border-bottom: 0; }
.quick-reply-panel .quick-reply-use { min-width: 0; height: auto; min-height: 38px; border: 0; padding: 7px 6px; background: transparent; color: #293531; font-size: 12px; line-height: 1.45; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.quick-reply-use:hover { color: var(--accent); background: #f8faf9; }
.quick-reply-editor { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px; padding: 7px 9px; border-bottom: 1px solid #e3e9e6; background: #fff; }
.quick-reply-editor input, .quick-reply-editor textarea { min-width: 0; }
.quick-reply-editor .primary-inline-command { min-height: 32px; height: 32px; padding: 5px 10px; }
.quick-reply-text-editor { border-top: 1px solid #e3e9e6; border-bottom: 0; }
.quick-reply-text-editor textarea { min-height: 62px; resize: vertical; }
.quick-reply-panel.collapsed > header { border-bottom: 0; }
.quick-reply-panel.collapsed .quick-reply-hint, .quick-reply-panel.collapsed .quick-reply-actions,
.quick-reply-panel.collapsed .quick-reply-workspace, .quick-reply-panel.collapsed > .quick-reply-editor { display: none; }
.detail-block { margin-bottom: 22px; }
.detail-block h4 { margin: 0 0 9px; font-size: 12px; color: var(--muted); }
.detail-text { margin: 0; line-height: 1.75; white-space: pre-wrap; }
.section-gap { margin-top: 28px; }
.detail-block pre { max-height: 360px; margin: 0; padding: 12px; overflow: auto; border: 1px solid #dce3e4; border-radius: 4px; background: #f7f9f8; color: #344246; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.conversation { display: grid; gap: 12px; }
.message { max-width: 84%; padding: 10px 12px; border-radius: 6px; line-height: 1.55; white-space: pre-wrap; }
.message.inbound { justify-self: start; background: #eef2f2; }
.message.outbound { justify-self: end; background: #dff1ed; }
.message-meta { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.dialog-actions { display: flex; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.patient-control-band { min-height: 62px; display: flex; align-items: center; gap: 10px; margin: -18px -18px 20px; padding: 12px 18px; background: #f7f9f9; border-bottom: 1px solid var(--line); }
.patient-control-band > div { display: flex; align-items: center; gap: 9px; margin-right: auto; }
.patient-control-band > div > span, .detail-state-grid span, .detail-form label > span { color: var(--muted); font-size: 12px; }
.patient-takeover-control { display: flex; align-items: center; gap: 7px; margin-right: 0 !important; padding: 5px 8px; border: 1px solid #e3d4b0; border-radius: 5px; background: #fff8e9; }
.patient-takeover-control > span { color: var(--muted); font-size: 11px; }
.patient-takeover-control > strong { min-width: 180px; font-size: 11px; }
.patient-takeover-control .row-command { padding: 4px 7px; font-size: 11px; }
.takeover-list-status { margin-top: 4px; }
.detail-state-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-state-grid > div { min-height: 76px; padding: 14px; border-right: 1px solid var(--line); }
.detail-state-grid > div:last-child { border-right: 0; }
.detail-state-grid strong { display: block; margin-top: 9px; }
.detail-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.inline-control { display: grid; grid-template-columns: minmax(0, 280px) auto; align-items: center; gap: 8px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-list > span:not(.muted-text) { padding: 5px 8px; border: 1px solid #cad7d8; border-radius: 4px; background: #f3f7f7; font-size: 12px; }
.muted-text { color: var(--muted); }
.detail-table-wrap { overflow: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-table { min-width: 620px; }
.detail-table th, .detail-table td { padding: 9px 10px; }
.event-list { border-top: 1px solid var(--line); }
.event-row { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(0, 1.2fr); gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.event-row strong, .event-row span { display: block; }
.event-row span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.event-row pre { max-height: 120px; margin: 0; overflow: auto; color: #445155; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-toolbar { min-height: 54px; display: grid; grid-template-columns: auto minmax(320px, 1fr) auto; align-items: center; gap: 12px; margin-bottom: 12px; }
.history-filters { display: grid; grid-template-columns: minmax(180px, 1fr) 150px; gap: 8px; }
.history-workspace { height: calc(100vh - 192px); min-height: 560px; display: grid; grid-template-columns: minmax(280px, .72fr) minmax(420px, 1.28fr); grid-template-rows: minmax(0, 1fr); overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.history-list-pane { min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) 54px; border-right: 1px solid var(--line); }
.history-result-list { min-height: 0; overflow-y: auto; }
.history-list-item { width: 100%; min-height: 108px; display: block; padding: 14px 16px; border: 0; border-bottom: 1px solid #e6ebec; border-left: 3px solid transparent; background: #fff; color: var(--ink); text-align: left; }
.history-list-item:hover { background: #f8fafa; }
.history-list-item.selected { border-left-color: var(--accent); background: #eef7f5; }
.history-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.history-list-head strong { font-size: 12px; }
.history-list-head small, .history-list-meta { color: var(--muted); font-size: 11px; }
.history-preview, .history-reply-preview { display: -webkit-box; margin-top: 8px; overflow: hidden; color: #344246; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.history-reply-preview { padding-left: 9px; border-left: 2px solid #83b9b1; color: #526065; }
.history-list-meta { display: block; margin-top: 8px; }
.history-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.history-pagination .icon-command { width: 30px; height: 30px; font-size: 21px; }
.history-detail { min-width: 0; min-height: 0; overflow-y: auto; background: #f7f9f9; }
.history-detail-head { position: sticky; top: 0; z-index: 1; min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.history-detail-head p { margin: 0 0 4px; color: var(--muted); font-size: 11px; }
.history-detail-head h3 { margin: 0; font-size: 14px; }
.history-detail-head > span { color: var(--muted); font-size: 12px; }
.history-transcript { display: grid; gap: 16px; padding: 22px; }
.history-message-row { max-width: 78%; display: grid; gap: 5px; }
.history-message-row.patient { justify-self: start; }
.history-message-row.human_agent, .history-message-row.ai_assistant { justify-self: end; }
.history-message-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 3px; color: var(--muted); font-size: 10px; }
.history-message-head strong { color: #48565a; font-size: 11px; }
.history-message-bubble { padding: 10px 12px; border: 1px solid #dce3e4; border-radius: 6px; background: #fff; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-message-row.human_agent .history-message-bubble { border-color: #bcded7; background: #e4f3ef; }
.history-message-row.ai_assistant .history-message-bubble { border-color: #e3d3aa; background: #fff7e5; }
.history-risk-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.history-risk-list span { display: inline-flex; align-items: center; min-height: 21px; padding: 2px 6px; border: 1px solid #e1c78e; border-radius: 4px; background: #fff7e5; color: #805912; font-size: 10px; }
.detail-form { display: grid; gap: 16px; }
.detail-form label { display: grid; gap: 7px; }
.form-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.glucose-chart { min-height: 258px; padding: 12px 12px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfc; }
.glucose-chart canvas { width: 100%; height: 220px; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; color: var(--muted); font-size: 11px; }
.chart-legend span::before { content: ""; width: 8px; height: 8px; display: inline-block; margin-right: 5px; border-radius: 50%; background: #69767a; }
.chart-legend .fasting::before { background: #168579; }
.chart-legend .pre-meal::before { background: #3573a6; }
.chart-legend .post-meal::before { background: #b86b23; }
.entry-list { display: grid; gap: 10px; max-height: 56vh; overflow: auto; }
.entry-row { padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fafcfc; }
.entry-row strong { display: block; font-size: 13px; }
.entry-row p { margin: 7px 0; line-height: 1.65; white-space: pre-wrap; }
.entry-row span { color: var(--muted); font-size: 11px; }
.workflow-node-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.workflow-node-list div { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 5px; }
.workflow-node-list span { width: 22px; height: 22px; display: grid; place-items: center; background: var(--surface-muted); color: var(--muted); border-radius: 4px; font-size: 10px; }
.workflow-node-list strong { font-size: 12px; }
.kv-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv-row span { color: var(--muted); }
.kv-row strong { line-height: 1.5; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 360px; padding: 11px 14px; border-radius: 5px; background: #203033; color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.18); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 16px 9px; }
  .brand { justify-content: center; padding: 0 0 18px; }
  .brand > div:last-child, .nav-item:not(.active) .nav-symbol + *, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-symbol { font-size: 11px; }
  .sidebar-footer { display: grid; justify-content: center; gap: 6px; text-align: center; }
  .metric-band { grid-template-columns: repeat(3, 1fr); }
  .metric:nth-child(3) { border-right: 0; }
  .metric:nth-child(n+4) { border-top: 1px solid var(--line); }
  .section-grid { grid-template-columns: 1fr; }
  .qiwe-account-panel { display: block; }
  .qiwe-account-picker { border-right: 0; border-bottom: 1px solid var(--line); }
  .qiwe-account-picker select { max-width: 360px; }
  .qiwe-account-summary { grid-template-columns: minmax(170px, .62fr) minmax(320px, 1.38fr); }
  .qiwe-account-metrics > div { padding: 11px; }
  .proactive-config-summary { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .proactive-config-summary > div { border-right: 1px solid var(--line); }
  .proactive-config-summary > div:nth-child(4n) { border-right: 0; }
  .proactive-config-summary > div:nth-child(n+5) { border-top: 1px solid var(--line); }
  .proactive-config-form { grid-template-columns: minmax(170px, 220px) minmax(150px, 1fr); }
  .proactive-config-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .intervention-inbox-layout { grid-template-columns: minmax(240px, .72fr) minmax(360px, 1.28fr); }
  .qiwe-management-workspace { grid-template-columns: minmax(320px, .82fr) minmax(340px, 1.18fr); }
  .history-toolbar { grid-template-columns: 1fr auto; }
  .history-filters { grid-column: 1 / -1; grid-row: 2; }
  .history-workspace { grid-template-columns: minmax(250px, .8fr) minmax(360px, 1.2fr); }
}

@media (max-width: 640px) {
  .quick-reply-panel:not(.collapsed) > header { align-items: stretch; flex-wrap: wrap; }
  .quick-reply-panel:not(.collapsed) .quick-reply-hint { order: 3; width: 100%; }
  .quick-reply-actions { width: 100%; }
  .quick-reply-actions .row-command { flex: 1; }
  .quick-reply-workspace { height: min(240px, 38vh); min-height: 210px; grid-template-columns: minmax(112px, 38%) minmax(0, 1fr); }
  .quick-reply-workspace > nav { grid-template-columns: 1fr; }
  .quick-reply-list { padding-right: 5px; padding-left: 5px; }
  .quick-reply-editor { grid-template-columns: minmax(0, 1fr) auto auto; }
  .app-shell { display: block !important; }
  .intervention-inbox-summary { grid-template-columns: repeat(3, 1fr); }
  .intervention-inbox-summary > div { min-height: 66px; padding: 11px; }
  #view-escalations .table-toolbar, .intervention-toolbar-filters { align-items: stretch; flex-direction: column; }
  .intervention-account-filter { justify-content: space-between; }
  .intervention-account-filter select { width: min(100%, 220px); }
  .intervention-inbox-layout { min-height: 0; display: block; }
  .intervention-event-list { max-height: 310px; border-right: 0; border-bottom: 1px solid var(--line); }
  .intervention-detail-head { align-items: flex-start; flex-direction: column; }
  .intervention-message-list { height: 46vh; min-height: 260px; padding: 15px 12px; }
  .intervention-rule-summary { grid-template-columns: repeat(3, 1fr); }
  .intervention-rule-summary > div { min-height: 66px; padding: 11px; }
  .intervention-rule-list { grid-template-columns: 1fr; }
  .qiwe-management-workspace { height: auto; display: block; min-height: 0; }
  .qiwe-management-workspace .qiwe-contact-table-wrap { height: 360px; max-height: 360px; border-right: 0; border-bottom: 1px solid var(--line); }
  .qiwe-inline-conversation { height: 560px; min-height: 0; }
  .sidebar { position: static; width: 100%; height: auto; padding: 10px 12px; }
  .brand { justify-content: flex-start; padding: 0 0 9px; border: 0; }
  .brand > div:last-child { display: block; }
  nav { display: flex; overflow-x: auto; margin: 0; gap: 4px; }
  .nav-item, .nav-item:not(.active) .nav-symbol + * { width: auto; min-width: 70px; height: 38px; font-size: 12px; justify-content: center; padding: 0 10px; }
  .nav-symbol { display: none; }
  .sidebar-footer { display: none; }
  .topbar { height: 72px; padding: 0 16px; }
  .topbar h2 { font-size: 18px; }
  .connection-status { display: none; }
  .view { padding: 16px; }
  .metric-band { grid-template-columns: repeat(2, 1fr); }
  .metric { min-height: 88px; padding: 16px; border-top: 1px solid var(--line); }
  .metric:nth-child(1), .metric:nth-child(2) { border-top: 0; }
  .metric:nth-child(2n) { border-right: 0; }
  .metric strong { font-size: 23px; }
  .filter-group { width: 100%; }
  .filter-group select { flex: 1; min-width: 0; }
  .table-toolbar { flex-wrap: wrap; }
  .proactive-followup-toolbar { align-items: stretch; }
  .proactive-followup-toolbar .segmented { width: 100%; }
  .proactive-followup-toolbar .segmented button { min-width: 0; flex: 1; padding: 0 8px; }
  .proactive-followup-toolbar-actions { width: 100%; justify-content: space-between; }
  .proactive-followup-filters { flex-wrap: wrap; }
  .proactive-followup-filters label { min-width: min(100%, 180px); flex: 1; }
  .proactive-date-filter { min-width: 0; flex: 1; }
  .proactive-date-filter input { min-width: 0; flex: 1; }
  .proactive-followup-toolbar-actions { flex-wrap: wrap; gap: 8px; }
  .proactive-batch-send { width: 100%; flex: 1 0 100%; }
  .proactive-config-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proactive-config-summary > div { min-height: 72px; border-right: 0; }
  .proactive-config-summary > div:nth-child(odd) { border-right: 1px solid var(--line); }
  .proactive-config-summary > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .proactive-config-form { display: flex; align-items: stretch; flex-direction: column; gap: 14px; }
  .proactive-sending-control { width: 100%; justify-content: space-between; }
  .proactive-config-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .proactive-config-actions button { width: 100%; }
  .proactive-followup-table-wrap { margin: 0 -16px; overflow: visible; border-right: 0; border-left: 0; border-radius: 0; }
  .proactive-followup-table { min-width: 0; table-layout: auto; }
  .proactive-followup-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .proactive-followup-table tbody, .proactive-followup-table tr { display: block; }
  .proactive-followup-table tr { padding: 9px 16px; border-bottom: 1px solid var(--line); }
  .proactive-followup-table tr:last-child { border-bottom: 0; }
  .proactive-followup-table td { min-height: 38px; display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: start; gap: 8px; padding: 7px 0; border: 0; }
  .proactive-followup-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
  .proactive-followup-table .proactive-followup-empty { display: block; padding: 0; }
  .proactive-followup-table .proactive-followup-empty::before { content: none; }
  .proactive-message-preview { max-width: none; -webkit-line-clamp: 4; }
  .proactive-mobile { white-space: normal; overflow-wrap: anywhere; }
  .qiwe-account-panel { display: block; }
  .qiwe-account-picker { border-right: 0; border-bottom: 1px solid var(--line); }
  .qiwe-account-summary { display: block; }
  .qiwe-account-identity { border-bottom: 1px solid var(--line); }
  .qiwe-account-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qiwe-account-metrics > div { min-height: 72px; border-left: 0; border-bottom: 1px solid var(--line); }
  .qiwe-account-metrics > div:nth-child(odd) { border-right: 1px solid var(--line); }
  .qiwe-account-metrics > div:nth-child(n+3) { border-bottom: 0; }
  .qiwe-contact-toolbar { align-items: stretch; }
  .qiwe-contact-search { width: 100%; grid-template-columns: 1fr 1fr; gap: 7px; }
  .qiwe-contact-search input, .qiwe-contact-search .result-count { grid-column: 1 / -1; }
  .qiwe-contact-toolbar .sync-command { width: 100%; }
  .qiwe-contact-table-wrap { margin: 0 -16px; overflow: visible; border-right: 0; border-left: 0; border-radius: 0; }
  .qiwe-contact-table { min-width: 0; table-layout: auto; }
  .qiwe-contact-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .qiwe-contact-table tbody, .qiwe-contact-table tr { display: block; }
  .qiwe-contact-table tr { padding: 9px 16px; border-bottom: 1px solid var(--line); }
  .qiwe-contact-table tr:last-child { border-bottom: 0; }
  .qiwe-contact-table td { min-height: 38px; display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 8px; padding: 7px 0; border: 0; }
  .qiwe-contact-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
  .qiwe-contact-table .qiwe-contact-empty { display: block; padding: 0; }
  .qiwe-contact-table .qiwe-contact-empty::before { content: none; }
  .qiwe-conversation-dialog { width: calc(100vw - 12px); max-height: calc(100vh - 12px); }
  .qiwe-conversation-overview { align-items: flex-start; flex-direction: column; gap: 10px; }
  .qiwe-message-legend { justify-content: flex-start; }
  .qiwe-message-scroll { height: min(48vh, 460px); min-height: 260px; }
  .qiwe-message-list { padding: 15px 12px; }
  .qiwe-message-row { max-width: 90%; }
  .qiwe-message-row.unknown { max-width: 96%; }
  .qiwe-message-media { grid-template-columns: minmax(0, 1fr); }
  .qiwe-conversation-composer { grid-template-columns: minmax(0, 1fr) 68px; padding: 10px 12px; }
  .workflow-node-list { grid-template-columns: 1fr; }
  .toolbar-actions { width: 100%; justify-content: space-between; }
  .monitoring-section .toolbar-actions { align-items: stretch; flex-direction: column; }
  .form-grid-two { grid-template-columns: 1fr; }
  .patient-control-band { align-items: stretch; flex-wrap: wrap; }
  .patient-control-band > div { width: 100%; }
  .detail-state-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-state-grid > div:nth-child(2) { border-right: 0; }
  .detail-state-grid > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .detail-grid-two { grid-template-columns: 1fr; gap: 0; }
  .event-row { grid-template-columns: 1fr; }
  .history-toolbar { display: flex; align-items: stretch; flex-direction: column; }
  .history-filters { grid-template-columns: 1fr; }
  .history-workspace { height: auto; min-height: 0; grid-template-columns: 1fr; overflow: visible; }
  .history-list-pane { height: 52vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .history-detail { min-height: 52vh; max-height: 68vh; }
  .history-message-row { max-width: 90%; }
}

/* Keep the brand layer last in the cascade for the local visual preview. */
.login-screen { background: #e8f0eb; }
.login-panel { width: min(100%, 410px); padding: 38px; border-color: #cbded3; border-radius: 10px; box-shadow: 0 24px 70px rgba(7, 94, 84, .14); }
.login-panel .brand-mark { width: 84px; height: 84px; margin-bottom: 26px; border-radius: 50%; }
.login-panel h1 { color: #075e54; font-size: 24px; }
.brand-mark { width: 40px; height: 40px; flex-basis: 40px; overflow: hidden; border-radius: 50%; background: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .16); }
.brand-logo { display: block; width: 100%; height: 100%; object-fit: cover; }
.app-shell { grid-template-columns: 242px minmax(0, 1fr); }
.sidebar { background: #075e54; padding: 22px 15px; }
.brand { gap: 12px; padding: 0 9px 25px; border-bottom-color: rgba(184, 212, 200, .2); }
.brand strong { color: #f5fbf7; font-size: 16px; letter-spacing: .02em; }
.brand span, .sidebar-footer { color: #b8d4c8; }
nav { gap: 5px; margin-top: 20px; }
.nav-item { height: 44px; border-radius: 7px; color: #c4dcd1; font-weight: 600; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 3px 0 0 #a6d8be; }
.nav-symbol { border-color: rgba(184, 212, 200, .42); border-radius: 50%; }
.nav-item.active .nav-symbol { border-color: #b6dfca; color: #e3f5e9; background: rgba(166, 216, 190, .2); }
main { background: #f3f6f2; }
.topbar { height: 92px; padding: 0 34px; background: rgba(255,255,255,.92); border-bottom-color: #d8e3dd; }
.eyebrow { color: #2f8766; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.topbar h2 { color: #075e54; font-size: 22px; }
.icon-command { border-color: #c7d9d0; border-radius: 50%; color: #0b6659; }
.icon-command:hover { border-color: #2f8766; background: #edf7f0; color: #1e6f56; }
.view { padding: 30px 34px 46px; }
.metric-band, .data-section, .qiwe-account-panel, .proactive-config-panel, .intervention-inbox-summary, .intervention-inbox-layout, .history-workspace, .qiwe-management-workspace { border-color: #d8e3dd; border-radius: 9px; box-shadow: 0 8px 26px rgba(21, 67, 52, .055); }
.metric { min-height: 112px; padding: 23px; }
.metric span { color: #667873; font-weight: 600; }
.metric strong { color: #075e54; font-size: 30px; }
.section-heading { min-height: 72px; padding: 14px 20px; }
.section-heading p { color: #2f8766; font-weight: 700; }
.section-heading h3, .dialog-head h3 { color: #075e54; font-size: 16px; }
input, select, textarea { border-color: #c6d8cf; border-radius: 7px; }
input:focus, select:focus, textarea:focus { border-color: #2f8766; box-shadow: 0 0 0 3px rgba(47, 135, 102, .14); }
.primary-command { border-radius: 7px; background: #2f8766; }
.primary-command:hover { background: #1e6f56; }
.row-command, .primary-inline-command { border-radius: 6px; }
.status { border-radius: 999px; font-weight: 800; }
.qiwe-account-picker { padding: 20px; background: #f7faf7; border-right-color: #d8e3dd; }
.qiwe-account-identity strong, .qiwe-account-metrics strong { color: #075e54; }
.qiwe-management-workspace .qiwe-contact-table-wrap { border-right-color: #d8e3dd; }
.qiwe-management-workspace .qiwe-contact-table thead th { background: #f5f9f6; box-shadow: 0 1px 0 #d8e3dd; }
.qiwe-contact-table tbody tr[data-contact-id].selected { box-shadow: inset 3px 0 0 #2f8766; background: #edf7f1; }
.qiwe-contact-table tbody tr[data-contact-id]:hover { background: #f5faf7; }
.qiwe-inline-conversation { background: #fbfdfb; }
.qiwe-chat-toolbar { background: #f6faf7; border-bottom-color: #d8e3dd; }
.qiwe-message-scroll, .intervention-message-list { background: #edf3ef; }
.qiwe-message-bubble { border-color: #d3e1da; box-shadow: 0 2px 5px rgba(21, 67, 52, .035); }
.qiwe-message-row.ai .qiwe-message-bubble { border-color: #a7d4bc; background: #e4f4eb; }
.qiwe-message-row.human .qiwe-message-bubble { border-color: #afd2cc; background: #e4f2f0; }
.qiwe-message-row.patient .qiwe-message-bubble { background: #fff; }
.qiwe-conversation-composer, .intervention-reply-form { background: #fff; border-top-color: #d8e3dd; }
.intervention-event-list { background: #f5f9f6; border-right-color: #d8e3dd; }
.intervention-event:hover { background: #edf7f1; }
.intervention-event.selected { box-shadow: inset 3px 0 0 #2f8766; background: #e4f3eb; }
.intervention-trigger { border-left-color: #2f8766; background: #f0f8f3; }
.history-list-item.selected { border-left-color: #2f8766; background: #edf7f1; }
.history-detail { background: #f5f9f6; }
.history-message-row.human_agent .history-message-bubble { border-color: #a8d5c0; background: #e4f4eb; }
.toast { border: 1px solid rgba(255,255,255,.2); border-radius: 7px; background: #075e54; }

@media (max-width: 980px) {
  .topbar, .view { padding-left: 24px; padding-right: 24px; }
}
[data-view="history"],
[data-view="resources"],
[data-view="workflows"],
[data-view="applications"],
[data-view="followups"],
[data-view="clinical-followups"],
#view-history,
#view-resources,
#view-workflows,
#view-applications,
#view-followups {
  display: none !important;
}
#view-clinical-followups { display: none !important; }
[data-view="catalog"], #view-catalog { display: none !important; }
.knowledge-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.knowledge-category-card { display: flex; flex-direction: column; min-height: 176px; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.knowledge-category-card:hover { border-color: var(--secondary); box-shadow: 0 8px 22px rgba(45, 53, 97, .1); transform: translateY(-1px); }
.knowledge-category-card h4 { margin: 8px 0 6px; color: var(--sidebar); font-size: 17px; }
.knowledge-category-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.knowledge-category-card .knowledge-card-count { margin-top: auto; color: var(--secondary); font-size: 13px; font-weight: 700; }
.knowledge-card-kicker { color: var(--muted); font-size: 11px; font-weight: 700; }
.knowledge-card-open { display: flex; flex: 1; flex-direction: column; border: 0; padding: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.knowledge-card-add { align-self: flex-start; margin-top: 12px; border: 0; padding: 0; background: transparent; color: var(--secondary); font-size: 12px; cursor: pointer; }
.knowledge-card-add:hover { text-decoration: underline; }
.knowledge-pending-section { margin-bottom: 18px; }
.knowledge-pending-list { display: grid; gap: 10px; }
.knowledge-pending-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid #e5c98b; border-radius: 8px; background: #fffaf0; }
.knowledge-pending-card h4 { margin: 4px 0; color: var(--sidebar); }
.knowledge-pending-card p { margin: 0; color: var(--muted); font-size: 12px; }
.knowledge-pending-actions { display: flex; gap: 8px; flex-shrink: 0; }
.detail-toolbar { display: flex; align-items: center; justify-content: flex-end; margin: 2px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.detail-toolbar + .entry-list { gap: 16px; }
.detail-toolbar + .entry-list .entry-row { padding: 18px 20px; }

/* 主动触达：匹配来源徽标与手工绑定弹层 */
.proactive-match-flag { display: inline-flex; align-items: center; border-radius: 4px; padding: 2px 6px; font-size: 10px; font-weight: 700; line-height: 1.4; }
.proactive-match-flag.warning { background: #fdf0dc; color: var(--warning); }
.proactive-match-flag.notice { background: #e3edfb; color: #2e5fa3; }
.proactive-match-flag.manual { background: #e4f2e9; color: var(--success); }
.proactive-bind-dialog { display: flex; flex-direction: column; gap: 12px; }
.proactive-bind-hint { font-size: 12px; color: #6b7a80; line-height: 1.6; }
.proactive-bind-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.proactive-bind-controls input[type="search"] { flex: 1 1 220px; min-width: 0; }
.proactive-bind-summary { min-height: 14px; font-size: 11px; color: #6b7a80; }
.proactive-bind-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.proactive-bind-candidate { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #dbe4e6; border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.proactive-bind-candidate.selected { border-color: var(--accent); background: #f2f5fc; }
.proactive-bind-candidate input[type="radio"] { width: 16px; height: 16px; margin: 3px 0 0; padding: 0; border: 0; flex: 0 0 auto; accent-color: var(--accent); }
.proactive-bind-candidate-info { display: flex; flex: 1 1 auto; flex-direction: column; gap: 4px; min-width: 0; }
.proactive-bind-candidate-info .cell-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.proactive-bind-meta { font-size: 11px; color: #6b7a80; word-break: break-all; }
.proactive-bind-note { font-size: 11px; border-radius: 4px; padding: 4px 8px; line-height: 1.5; }
.proactive-bind-note.warn { background: #fdf0dc; color: var(--warning); }
.proactive-bind-note.ok { background: #e4f2e9; color: var(--success); }

.binding-search { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.binding-search input { width: min(320px, 100%); }
.binding-filter { display: flex; align-items: center; gap: 8px; }
.binding-filter select { min-width: 150px; }
.binding-note { color: var(--muted); font-size: 13px; line-height: 1.6; }
#view-binding-management table { min-width: 950px; }
#view-binding-management td { white-space: normal; overflow-wrap: anywhere; }
#view-binding-management td:last-child { min-width: 125px; }
.binding-search-form { display: flex; gap: 8px; margin: 12px 0; }
.binding-search-form input { flex: 1; min-width: 0; }
#binding-candidates { max-height: 380px; overflow-y: auto; }
.binding-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px; margin: 8px 0; border: 1px solid #dbe4e6; border-radius: 8px; cursor: pointer; }
.binding-option:has(input:checked) { border-color: var(--accent); background: #f2f5fc; }
.binding-option input[type="radio"] { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 4px; }
.binding-option span { overflow-wrap: anywhere; line-height: 1.6; }

/* Dashboard: scoped visual analytics. */
#view-dashboard { background: #f5f8fb; padding: 14px; border-radius: 20px; }
#dashboard-metrics { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; border: 0; background: none; }
.dashboard-metric-group { min-width:0; }
.dashboard-metric-group h3 { margin:0 0 6px; font-size:12px; color:#526975; font-weight:600; }
.dashboard-metric-row { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; }
.dashboard-card-ratios { display:flex; flex-direction:column; gap:3px; margin-bottom:7px; }
.dashboard-card .dashboard-card-history { margin-top:auto; }
.dashboard-chart-ratio { display:block; font-size:10px; color:#647d88; line-height:1.5; margin-top:2px; }
.dashboard-chart-point:focus-visible { outline:none; stroke:#183c46; stroke-width:2; }
#dashboard-metrics .dashboard-card { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-height: 88px; padding: 11px 13px; background: white; border: 1px solid #e4ebf1; border-radius: 10px; cursor: pointer; font: inherit; transition: transform .15s, box-shadow .15s; }
#dashboard-metrics .dashboard-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px #123a4210; border-color: #6fb9b1; }
#dashboard-metrics .dashboard-card:focus-visible { outline: 3px solid #0d9488; outline-offset: 2px; }
.dashboard-card strong { font-size: 22px; color: #183c46; margin: 5px 0; font-variant-numeric: tabular-nums; }
.dashboard-card small { font-size: 11px; color: #77909b; }
#view-dashboard .data-section { background: white; border: 1px solid #e4ebf1; border-radius: 14px; padding: 16px 20px; margin-top: 14px; }
.dashboard-trend { width: calc(50% - 10px); box-sizing: border-box; }
.dashboard-chart { width: 100%; height: auto; max-height: 270px; }
.dashboard-chart text { font-size: 11px; fill: #78909b; }
.dashboard-legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12px; color: #526975; padding: 8px 0; }
.dashboard-legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: -1px; }
.dashboard-reason { position: relative; padding-bottom: 16px; margin-bottom: 8px; }
.dashboard-reason::after { content: ''; position: absolute; bottom: 2px; left: 0; width: var(--share); height: 4px; background: #49a99c; border-radius: 4px; }
.dashboard-pie-layout { display:flex; align-items:center; gap:28px; margin-top:20px; }
.dashboard-reason-pie { width:180px; height:180px; display:block; flex:0 0 180px; }
.dashboard-reason-pie .pie-total { fill:#174a4e; font-size:26px; font-weight:700; }
.dashboard-reason-pie .pie-label { fill:#78909b; font-size:11px; }
.dashboard-pie { width:168px; height:168px; flex:0 0 168px; border-radius:50%; padding:14px; box-sizing:border-box; background:var(--pie); }
.dashboard-pie>div { height:100%; border-radius:50%; background:#fff; display:flex; flex-direction:column; justify-content:center; align-items:center; }
.dashboard-pie strong { color:#174a4e; font-size:28px; }
.dashboard-pie span { color:#78909b; font-size:12px; margin-top:4px; }
.dashboard-pie-legend { flex:1; min-width:0; max-height:260px; overflow:auto; }
.dashboard-pie-legend-row { display:grid; grid-template-columns:12px minmax(0,1fr) auto; align-items:center; gap:8px; padding:8px 0; border-bottom:1px solid #eef2f4; font-size:12px; color:#526975; }
.dashboard-pie-legend-row strong { color:#183c46; font-variant-numeric:tabular-nums; }
.dashboard-image-fail-link { border:0; padding:0; background:none; color:#e05270; font:inherit; cursor:pointer; text-decoration:underline; }
.dashboard-failure-list { max-height:420px; overflow:auto; }
.dashboard-failure-list>div { padding:12px 0; border-bottom:1px solid #edf1f3; display:flex; flex-direction:column; gap:5px; }
.dashboard-failure-list small { color:#78909b; }
.dashboard-failure-image { display:block; max-width:260px; max-height:180px; object-fit:contain; border-radius:8px; border:1px solid #e4ebf1; margin-bottom:8px; }
@media(max-width:1000px) { .dashboard-metric-row { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:1100px) { .dashboard-trend { width:100%; } }
@media(max-width:700px) { #view-dashboard { padding:12px; } .dashboard-metric-row { grid-template-columns:repeat(2,minmax(0,1fr)); } #view-dashboard .section-grid { grid-template-columns:1fr; } .dashboard-pie-layout { align-items:flex-start; flex-direction:column; } }

.dashboard-donut-row { display:flex; align-items:center; gap:24px; flex-wrap:wrap; margin-bottom:20px; }
.dashboard-donut { width:144px; height:144px; border-radius:50%; background:conic-gradient(#0d9488 var(--rate),#edf1f5 0); padding:12px; box-sizing:border-box; flex-shrink:0; }
.dashboard-donut>div { border-radius:50%; background:white; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.dashboard-donut strong { font-size:24px; color:#174a4e; }
.dashboard-donut span,.dashboard-donut-row small { font-size:11px; color:#78909b; }
.dashboard-donut-row p { max-width:200px; font-size:13px; line-height:1.9; }

#dashboard-metrics .dashboard-batch-count { font-size: 13px; font-weight: 500; color: #526975; margin-left: 4px; }

/* Equal desktop panels; SVG paint attributes work with the admin CSP. */
#view-dashboard .dashboard-panels { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:14px; }
#view-dashboard .dashboard-panels>.data-section { min-width:0; margin:0; }
.dashboard-history-scroll { max-height:280px; overflow:auto; }
.dashboard-panels .dashboard-chart { display:block; width:100%; height:auto; max-height:280px; }
.dashboard-legend>span { display:inline-flex; align-items:center; }
svg.dashboard-legend-swatch { flex:none; width:10px; height:10px; }
.dashboard-pie-interactive { width:180px; flex:none; }
.dashboard-pie-tooltip { min-height:42px; font-size:12px; text-align:center; color:#174a4e; padding:6px; line-height:1.5; }
.dashboard-pie-sector:hover,.dashboard-pie-sector:focus { opacity:.8; stroke:white; stroke-width:2; cursor:default; }
.dashboard-image-ring { width:144px; height:144px; flex:none; }
.dashboard-image-ring .pie-total { fill:#174a4e; font-size:24px; font-weight:700; }
.dashboard-image-ring .pie-label { fill:#78909b; font-size:9px; }
.dashboard-panels .dashboard-pie-layout { gap:14px; }
@media(max-width:900px) { #view-dashboard .dashboard-panels { grid-template-columns:1fr; } }

/* Suppress pointer focus rectangle; keyboard focus follows the actual sector. */
.dashboard-pie-sector:focus { outline:none; }
.dashboard-pie-sector:focus-visible { outline:none; stroke:#123b42; stroke-width:3; }
.dashboard-day-note { font-size:12px; color:#78909b; margin:12px 0; }
.dashboard-day-bars { display:grid; gap:14px; padding:10px 0; }
.dashboard-day-bar { display:grid; grid-template-columns:minmax(130px,1.2fr) minmax(50px,1fr) 65px; gap:12px; align-items:center; font-size:12px; }
.dashboard-day-bar svg { width:100%; height:14px; }
.dashboard-day-bar strong { text-align:right; font-variant-numeric:tabular-nums; }
@media(max-width:600px) { .dashboard-day-bar { grid-template-columns:100px minmax(30px,1fr) 65px; gap:8px; } }

#dashboard-human .dashboard-human-summary { display:flex; flex-wrap:wrap; align-items:center; gap:12px 24px; padding:10px 0; border-bottom:1px solid #edf1f3; }
#dashboard-human .dashboard-human-summary .compact-row { display:flex; flex:0 0 auto; align-items:center; gap:10px; padding:0; min-height:0; border:0; }
#dashboard-human .dashboard-human-summary .compact-row span,
#dashboard-human .dashboard-human-summary .compact-row strong { white-space:nowrap; }
@media(max-width:600px) { #dashboard-human .dashboard-human-summary .compact-row { flex-wrap:wrap; } #dashboard-human .dashboard-human-summary .compact-row span { white-space:normal; } }

#view-outreach-dashboard { padding:14px; background:#f5f8fb; border-radius:16px; }
.outreach-metrics { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
.outreach-metric { padding:14px; border:1px solid #e4ebf1; border-radius:10px; background:white; display:flex; flex-direction:column; gap:8px; font-size:12px; }
.outreach-metric strong { font-size:24px; color:#183c46; }
#view-outreach-dashboard .data-section { padding:16px 20px; margin-top:14px; border:1px solid #e4ebf1; border-radius:14px; background:white; }
#outreach-dashboard-chart { max-width:1000px; margin:auto; }
@media(max-width:800px) { .outreach-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); } }

.dashboard-tabs { margin-bottom:16px; width:fit-content; }
#view-dashboard [role="tabpanel"][hidden] { display:none; }
#view-dashboard #view-outreach-dashboard { padding:0; }

#dashboard-images .dashboard-image-stats { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:20px; }
#dashboard-images .dashboard-image-stats .compact-row { display:flex; justify-content:space-between; align-items:center; gap:10px; min-width:0; padding:10px 0; }
#dashboard-images .dashboard-image-stats strong { flex:none; }

#dashboard-reply-pie .dashboard-pie-layout { margin-top:0; }

.dashboard-coverage { display:flex; align-items:center; gap:24px; padding:12px 0; border-bottom:1px solid #edf1f3; }
.dashboard-coverage>div { display:flex; flex-direction:column; gap:5px; min-width:190px; }
.dashboard-coverage span { font-size:12px; color:#526975; }
.dashboard-coverage strong { font-size:32px; color:#0d9488; }
.dashboard-coverage p { font-size:12px; line-height:1.8; color:#647d88; margin:0; }
.dashboard-metric-row { grid-template-columns:repeat(5,minmax(0,1fr)); }
@media(max-width:1000px) { .dashboard-metric-row { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:700px) { .dashboard-metric-row { grid-template-columns:repeat(2,minmax(0,1fr)); } .dashboard-coverage { flex-direction:column; align-items:flex-start; gap:8px; } }

/* Desktop overview: chart first, grouped metrics beside it. */
.dashboard-summary-layout { display:grid; grid-template-columns:minmax(320px, .9fr) minmax(0,2fr); gap:16px; align-items:stretch; }
#view-dashboard .dashboard-summary-layout>.dashboard-reply-section { margin:0; padding:14px 18px; }
.dashboard-summary-details { min-width:0; display:flex; }
#dashboard-reply-pie .dashboard-pie-layout { flex-direction:column; gap:0; align-items:center; }
#dashboard-reply-pie .dashboard-pie-interactive { width:280px; max-width:100%; }
#dashboard-reply-pie .dashboard-reason-pie { width:100%; height:auto; }
#dashboard-reply-pie .dashboard-pie-interactive { margin-bottom:16px; }
#dashboard-reply-pie .dashboard-pie-legend { width:100%; max-height:none; overflow:visible; }
#dashboard-reply-pie .dashboard-pie-legend-row { padding:6px 0; gap:6px; }
#dashboard-reply-pie .dashboard-coverage { display:block; min-height:96px; box-sizing:border-box; padding:0 0 8px; }
#dashboard-reply-pie .dashboard-coverage>div { flex-direction:row; align-items:center; justify-content:space-between; gap:8px; }
#dashboard-reply-pie .dashboard-coverage p { font-size:11px; line-height:1.5; }
.dashboard-summary-details #dashboard-metrics { margin:0; gap:14px; width:100%; grid-template-rows:repeat(3,minmax(0,1fr)); }
.dashboard-summary-details #dashboard-metrics .dashboard-card { padding:10px; min-width:0; }
.dashboard-summary-details .dashboard-card strong { font-size:21px; }
#dashboard-batch-note.dashboard-scope-note { margin:10px 2px 0; font-size:11px; color:#78909b; }
.dashboard-summary-details .dashboard-metric-group { display:flex; flex-direction:column; gap:7px; }
.dashboard-summary-details .dashboard-metric-group h3 { margin:0; line-height:18px; font-size:12px; }
.dashboard-summary-details .dashboard-metric-row { flex:1; }
.dashboard-summary-details .dashboard-metric-group:last-child .dashboard-metric-row { grid-template-columns:repeat(3,minmax(0,1fr)); }
.dashboard-summary-details #dashboard-metrics .dashboard-card { border-radius:12px; padding:13px 12px; gap:2px; }
.dashboard-summary-details .dashboard-card>span:first-child { min-height:32px; line-height:16px; font-size:12px; color:#526975; }
.dashboard-summary-details .dashboard-card-ratios { line-height:1.6; }
.dashboard-summary-details .dashboard-card strong { line-height:1.4; margin:2px 0 7px; }
#view-dashboard .dashboard-panels { gap:16px; align-items:stretch; }
#view-dashboard .dashboard-panels>.data-section { display:flex; flex-direction:column; }
#view-dashboard .dashboard-panels .section-heading { min-height:50px; margin-bottom:12px; }
.dashboard-pie-interactive { flex-shrink:0; }
.dashboard-pie-tooltip { min-height:76px; padding:10px 6px; box-sizing:border-box; line-height:1.6; }
#dashboard-human .dashboard-pie-layout { align-items:flex-start; margin-top:20px; }
#dashboard-human .dashboard-pie-legend { max-height:300px; }
#dashboard-images .dashboard-donut-row { margin:4px 0 18px; }
#dashboard-images .dashboard-image-stats { margin-top:auto; }
.dashboard-history-scroll { flex:1; }
@media(max-width:850px) { .dashboard-summary-details #dashboard-metrics { grid-template-rows:auto; } }
@media(max-width:550px) { .dashboard-summary-details .dashboard-metric-group:last-child .dashboard-metric-row { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:1250px) {
  .dashboard-summary-layout { grid-template-columns:320px minmax(0,1fr); }
  .dashboard-summary-details .dashboard-metric-row { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media(max-width:850px) {
  .dashboard-summary-layout { grid-template-columns:minmax(0,1fr); }
  #dashboard-reply-pie .dashboard-pie-layout { flex-direction:row; gap:18px; }
  #dashboard-reply-pie .dashboard-pie-interactive { flex:0 0 260px; }
}
@media(max-width:550px) {
  .dashboard-summary-details .dashboard-metric-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #dashboard-reply-pie .dashboard-pie-layout { flex-direction:column; }
  #dashboard-reply-pie .dashboard-pie-interactive { flex:auto; }
}

.dashboard-history-switch { width:fit-content; margin-bottom:14px; }
#detail-dialog .dashboard-chart { max-height:360px; }

/* Executive dashboard: large charts, concise labels, message-based reporting. */
.dashboard-lead { display:flex; align-items:center; flex-wrap:wrap; gap:12px 28px; margin:0 0 20px; font-size:13px; color:#64748b; }
.dashboard-lead strong { color:#163a43; font-size:21px; font-variant-numeric:tabular-nums; margin:0 5px; }
.dashboard-executive-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
#view-dashboard .dashboard-executive-card { margin:0; padding:22px 26px; min-width:0; border:1px solid #e4ebf1; border-radius:18px; background:#fff; }
#view-dashboard .dashboard-executive-card .section-heading { margin:0 0 10px; align-items:center; min-height:28px; }
#view-dashboard .section-heading>span { font-size:11px; color:#82929e; white-space:nowrap; }
.dashboard-pie-head { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:4px 14px; min-height:64px; padding-bottom:12px; border-bottom:1px solid #eef2f5; }
.dashboard-pie-head>span { font-size:13px; color:#64748b; }
.dashboard-pie-head>strong { grid-row:span 2; font-size:34px; color:#163a43; font-variant-numeric:tabular-nums; letter-spacing:-1px; }
.dashboard-pie-head>small { color:#82929e; font-size:12px; min-height:18px; }
.dashboard-executive-pie-body { display:grid; grid-template-columns:minmax(180px,1.25fr) minmax(130px,1fr); gap:22px; align-items:center; min-height:248px; padding-top:12px; }
.dashboard-executive-pie { width:100%; max-width:300px; height:auto; justify-self:center; overflow:visible; }
.dashboard-executive-pie .pie-total { font-size:22px; font-weight:700; fill:#163a43; }
.dashboard-executive-pie .pie-label { font-size:9px; fill:#82929e; }
.dashboard-executive-pie text { pointer-events:none; }
.dashboard-executive-legend { display:grid; gap:22px; align-content:start; max-height:310px; overflow:auto; }
.dashboard-executive-legend-row { display:grid; grid-template-columns:10px minmax(0,1fr) auto; align-items:center; gap:7px; font-size:12px; }
.dashboard-executive-legend-row>svg { width:10px; height:10px; }
.dashboard-executive-legend-row>span { color:#506571; line-height:1.5; }
.dashboard-executive-legend-row>strong { color:#163a43; font-size:15px; font-variant-numeric:tabular-nums; }
.dashboard-executive-legend-row>small { grid-column:2 / -1; color:#82929e; font-size:11px; }
.dashboard-pie-foot { font-size:11px; color:#82929e; margin-top:8px; }
#view-dashboard .dashboard-panels { margin-top:20px; gap:20px; }
#view-dashboard .dashboard-panels>.data-section { padding:22px 26px; border-radius:18px; }
#view-dashboard .dashboard-panels .section-heading { min-height:28px; }
.dashboard-more { margin-top:20px; }
.dashboard-more>summary { cursor:pointer; color:#64748b; font-size:12px; padding:14px 0; }
@media(min-width:1600px) { .dashboard-executive-pie-body { grid-template-columns:minmax(220px,1fr) minmax(170px,1fr); } }
@media(max-width:1150px) {
  #view-dashboard .dashboard-executive-card, #view-dashboard .dashboard-panels>.data-section { padding:18px; }
  .dashboard-executive-pie-body { gap:12px; grid-template-columns:minmax(140px,1fr) minmax(125px,1fr); }
  .dashboard-executive-legend-row { grid-template-columns:10px minmax(0,1fr); }
  .dashboard-executive-legend-row>strong { grid-column:2; }
}
@media(max-width:850px) { .dashboard-executive-grid { grid-template-columns:1fr; } .dashboard-executive-pie-body { grid-template-columns:minmax(150px,1fr) minmax(140px,1fr); } }
@media(max-width:480px) { .dashboard-executive-pie-body { grid-template-columns:1fr; } .dashboard-executive-pie { max-width:250px; } .dashboard-executive-legend { width:100%; padding:8px 0; } .dashboard-executive-legend-row { grid-template-columns:10px minmax(0,1fr) auto; } .dashboard-executive-legend-row>strong { grid-column:3; } }

.dashboard-executive-card .dashboard-executive-legend { max-height:none; overflow:visible; }
#dashboard-human .dashboard-executive-legend { gap:14px; }
.dashboard-day-bar { grid-template-columns:minmax(100px,1fr) minmax(50px,1fr) 96px; }
.dashboard-day-bar strong { white-space:nowrap; }
.dashboard-history-action { border:0; background:transparent; color:#0d9488; padding:4px 6px; cursor:pointer; font-size:16px; }
#dashboard-token-total { margin-left:16px; color:#82929e; }

/* Three charts per desktop row, with the three AI views grouped first. */
.dashboard-executive-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
#view-dashboard .dashboard-executive-card { padding:18px; container-type:inline-size; }
#view-dashboard .dashboard-executive-card .section-heading { flex-wrap:wrap; gap:4px 10px; min-height:44px; }
#view-dashboard .dashboard-executive-card .section-heading h3 { font-size:14px; }
.dashboard-executive-card .dashboard-executive-pie-body { grid-template-columns:minmax(0,1fr); gap:10px; min-height:0; padding-top:8px; }
.dashboard-executive-card .dashboard-executive-pie { max-width:220px; }
.dashboard-executive-card .dashboard-executive-legend { gap:10px; width:100%; }
.dashboard-executive-card .dashboard-executive-legend-row { grid-template-columns:10px minmax(0,1fr) auto; gap:3px 7px; }
.dashboard-executive-card .dashboard-executive-legend-row>strong { grid-column:3; }
.dashboard-executive-card .dashboard-executive-legend-row>small { grid-column:2 / -1; }
.dashboard-executive-card .dashboard-pie-head>strong { font-size:30px; }
.dashboard-executive-card .dashboard-day-bar { grid-template-columns:minmax(78px,1fr) minmax(30px,.7fr) 88px; gap:8px; }
.dashboard-executive-card .dashboard-chart { width:100%; height:auto; }
@container(min-width:440px) {
  .dashboard-executive-card .dashboard-executive-pie-body { grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); gap:16px; min-height:260px; }
  .dashboard-executive-card .dashboard-executive-pie { max-width:280px; }
}
@media(max-width:1100px) { .dashboard-executive-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:700px) { .dashboard-executive-grid { grid-template-columns:minmax(0,1fr); } }

.dashboard-human-section { grid-column:1 / -1; }
#dashboard-human .dashboard-executive-pie-body { grid-template-columns:minmax(220px,.8fr) minmax(0,2fr); gap:32px; align-items:center; padding-top:20px; }
#dashboard-human .dashboard-executive-pie { max-width:300px; }
#dashboard-human .dashboard-executive-legend { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 28px; max-height:none; overflow:visible; }
#dashboard-human .dashboard-executive-legend-row { padding:8px 0; border-bottom:1px solid #edf2f5; align-content:start; }
@media(max-width:1100px) { #dashboard-human .dashboard-executive-pie-body { grid-template-columns:minmax(0,1fr); gap:18px; } }
@media(max-width:550px) { #dashboard-human .dashboard-executive-legend { grid-template-columns:minmax(0,1fr); } }

/* Presentation typography: two pixels larger throughout the dashboard. */
#view-dashboard { font-size:16px; padding-bottom:96px; }
#view-dashboard .segmented button { font-size:16px; height:36px; }
#view-dashboard .result-count, #dashboard-updated, #outreach-dashboard-updated { font-size:14px; }
#view-dashboard .dashboard-lead { font-size:15px; padding-inline:24px; }
#view-dashboard .dashboard-lead strong { font-size:23px; }
#view-dashboard .section-heading h3 { font-size:18px; }
#view-dashboard .dashboard-executive-card .section-heading h3 { font-size:16px; }
#view-dashboard .section-heading>span { font-size:13px; }
#view-dashboard .dashboard-pie-head>span { font-size:15px; }
#view-dashboard .dashboard-pie-head>strong { font-size:32px; }
#view-dashboard .dashboard-pie-head>small { font-size:14px; }
#view-dashboard .dashboard-executive-pie .pie-total { font-size:24px; }
#view-dashboard .dashboard-executive-pie .pie-label { font-size:11px; }
#view-dashboard .dashboard-executive-legend-row { font-size:14px; }
#view-dashboard .dashboard-executive-legend-row>strong { font-size:17px; }
#view-dashboard .dashboard-executive-legend-row>small { font-size:13px; }
#view-dashboard .dashboard-pie-foot { font-size:13px; }
#view-dashboard .dashboard-history-action { font-size:18px; }
#view-dashboard .dashboard-chart text { font-size:13px; }
#view-dashboard .dashboard-legend, #view-dashboard .dashboard-day-note, #view-dashboard .dashboard-day-bar { font-size:14px; }
#view-dashboard .dashboard-chart-ratio { font-size:12px; }
#view-dashboard .outreach-metric { font-size:14px; }
#view-dashboard .outreach-metric strong { font-size:26px; }
#view-dashboard th { font-size:13px; }
#view-dashboard td { font-size:16px; }
#view-dashboard .cell-subtitle { font-size:14px; }
.dashboard-performance { margin-top:28px; }
.dashboard-performance-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding-inline:24px; }
.dashboard-performance-heading h3 { margin:0; font-size:18px; color:#163a43; }
#dashboard-token-total { font-size:14px; margin-left:0; }
.dashboard-performance .dashboard-day-bar { grid-template-columns:minmax(120px,1fr) minmax(40px,1fr) 130px; }
body:has(#view-dashboard.active) .topbar h2 { font-size:24px; }
body:has(#view-dashboard.active) .eyebrow,
body:has(#view-dashboard.active) .connection-status,
body:has(#view-dashboard.active) .sidebar-footer,
body:has(#view-dashboard.active) .brand span { font-size:14px; }
body:has(#view-dashboard.active) .brand strong { font-size:17px; }
body:has(#view-dashboard.active) .nav-group-title { font-size:12px; }
body:has(#view-dashboard.active) .nav-symbol { font-size:13px; }
body:has(#view-dashboard.active) .nav-item { font-size:16px; }
body:has(#view-dashboard.active) #detail-dialog { font-size:16px; }
body:has(#view-dashboard.active) #detail-dialog .dialog-head h3 { font-size:18px; }
body:has(#view-dashboard.active) #detail-dialog .dialog-head p,
body:has(#view-dashboard.active) #detail-dialog .cell-subtitle,
body:has(#view-dashboard.active) #detail-dialog .dashboard-legend { font-size:14px; }
body:has(#view-dashboard.active) #detail-dialog .segmented button { font-size:16px; }
body:has(#view-dashboard.active) #detail-dialog .dashboard-chart text { font-size:13px; }
@media(max-width:600px) { .dashboard-performance .dashboard-day-bar { grid-template-columns:minmax(0,1fr) 110px; } .dashboard-performance .dashboard-day-bar svg { grid-column:1; grid-row:2; } .dashboard-performance .dashboard-day-bar strong { grid-column:2; grid-row:1 / 3; } }

body:has(#view-dashboard.active) .topbar .eyebrow { display:none; }

#view-dashboard .dashboard-history-action { margin-left:auto; padding:6px 14px; border:1px solid #cadfdc; border-radius:7px; background:#f3faf8; color:#0d766d; font-size:16px; line-height:1.25; }
#view-dashboard .dashboard-history-action:hover { background:#e5f4ef; border-color:#0d9488; }
.dashboard-chart-tooltip { pointer-events:none; }
.dashboard-chart-tooltip rect { fill:#163a43; stroke:#fff; stroke-width:1; }
#view-dashboard .dashboard-chart .dashboard-chart-tooltip text,
body:has(#view-dashboard.active) #detail-dialog .dashboard-chart .dashboard-chart-tooltip text { fill:white; font-size:14px; }
.dashboard-chart-tooltip text:nth-of-type(2) { font-weight:700; }

#dashboard-human .dashboard-pie-head { grid-template-columns:minmax(0,260px) max-content; justify-content:start; column-gap:24px; }
#dashboard-human .dashboard-pie-head>strong { grid-column:2; grid-row:1 / span 2; }
@media(max-width:550px) { #dashboard-human .dashboard-pie-head { grid-template-columns:minmax(0,1fr) max-content; column-gap:16px; } }

/* Shared card alignment: titles, summaries and content use one left edge. */
#view-dashboard .data-section .section-heading {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:8px;
  height:56px;
  min-height:56px;
  box-sizing:border-box;
  padding:0 0 12px;
  margin:0 0 10px;
}
#view-dashboard .data-section .section-heading h3 { line-height:1.35; }
#view-dashboard .dashboard-pie-head {
  height:80px;
  min-height:80px;
  box-sizing:border-box;
  grid-template-rows:minmax(0,1fr) 20px;
}
#view-dashboard .dashboard-pie-head>span { grid-column:1; grid-row:1 / span 2; align-self:center; }
#view-dashboard .dashboard-pie-head>strong { grid-column:2; grid-row:1 / span 2; align-self:center; }
#view-dashboard .dashboard-pie-head:has(>small)>span { grid-row:1; align-self:end; }
#view-dashboard .dashboard-pie-head>small { grid-column:1; grid-row:2; align-self:start; }
#view-dashboard .dashboard-executive-pie-body { align-items:start; }
#view-dashboard .dashboard-executive-pie { align-self:start; }

.dashboard-summary-toolbar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px 24px; margin-bottom:20px; }
#view-dashboard .dashboard-summary-toolbar .dashboard-lead { margin:0; }
.dashboard-account-toolbar { display:flex; align-items:center; gap:14px; margin-left:auto; flex-shrink:0; }
.dashboard-account-toolbar label { font-size:16px; font-weight:600; color:#163a43; }
#dashboard-account-select, #dashboard-date-select { width:260px; max-width:100%; min-height:42px; padding:8px 12px; border:1px solid #cadfdc; border-radius:8px; background:#fff; color:#163a43; font:inherit; }
#dashboard-panel-service[aria-busy="true"]>.dashboard-executive-grid { opacity:.65; }
@media(max-width:700px) { .dashboard-account-toolbar { flex-wrap:wrap; } }

#dashboard-date-select { width:166px; }
