/* Application states and forms extend the approved BeeMax design. */
.module-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.module-tabs a { padding: 12px 0; white-space: nowrap; color: var(--muted); border-bottom: 2px solid transparent; }
.module-tabs a.active { color: var(--action); border-bottom-color: var(--action); font-weight: 600; }
[hidden] {
  display: none !important;
}
.loading-screen {
  padding: 80px 30px;
  text-align: center;
}
.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--soft);
  padding: 30px;
  max-width: none;
}
.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  padding: 36px;
}
.login-card > img {
  width: 48px;
  margin-bottom: 18px;
}
.login-card h1 {
  font-size: 30px;
  margin: 6px 0;
}
.login-card p,
.login-card small {
  color: var(--muted);
}
.login-card small {
  display: block;
  font-size: 11px;
  line-height: 1.8;
  margin-top: 24px;
}
.login-card label {
  display: block;
  margin: 18px 0;
  font-size: 13px;
}
.login-card input {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.login-card button {
  width: 100%;
  margin-top: 8px;
}
.form-error {
  color: var(--navy);
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
}
.form-error:empty {
  display: none;
}
.workspace > div {
  min-width: 0;
}
.workspace strong {
  font-weight: 600;
}
.sidebar .profile {
  padding-left: 0;
  padding-right: 0;
  gap: 8px;
}
.profile > div {
  min-width: 0;
}
.profile small {
  overflow-wrap: anywhere;
}
.profile .icon-button {
  margin-left: auto;
  flex-shrink: 0;
}
.config-title select,
.filters select,
.chat-history-select select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 9px;
  max-width: 100%;
}
.report-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 24px;
  margin-top: 24px;
}
.report-content {
  padding: 0 24px 24px;
}
.report-summary {
  font-size: 14px;
  line-height: 1.9;
  white-space: pre-wrap;
}
.report-content .connection-kpis {
  margin: 22px 0;
}
.report-content .connection-kpis strong {
  font-size: 26px;
}
.report-history {
  align-self: start;
}
.report-history > button {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--white);
  border: 0;
  border-top: 1px solid var(--line);
  padding: 18px 20px;
  color: var(--navy);
}
.report-history > button.active {
  background: var(--blue-soft);
}
.report-history small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
  font-size: 11px;
}
.live-schedules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 24px 20px;
  gap: 16px;
}
.schedule-preview {
  border: 0;
  border-left: 1px solid var(--line);
  text-align: left;
  background: var(--white);
  padding: 10px 16px;
  color: var(--navy);
}
.schedule-preview strong {
  margin-right: 10px;
  font-size: 13px;
}
.schedule-preview small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 8px;
}
.plans-summary {
  margin-top: 24px;
}
.live-advice {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.live-advice p {
  font-size: 12px;
  line-height: 1.8;
}
.live-advice > div {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.live-advice h3 {
  font-size: 16px;
}
.inline-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
}
.inline-check input {
  width: auto !important;
  margin: 0 !important;
}
.wide-dialog {
  width: 680px;
}
.ticket-dialog {
  width: 600px;
}
.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-history-select {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.chat-history-select label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-history-select select {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  padding: 5px;
}
.chat-messages .chat-reply > div > strong,
.chat-messages .chat-user > div > strong {
  font-size: 12px;
}
.chat-messages small {
  font-size: 10px;
  color: var(--muted);
}
.assistant-widget .chat-messages {
  flex: 1;
  min-height: 80px;
  overflow: auto;
}
.assistant-widget .message-text {
  font-size: 12px;
  line-height: 1.85;
}
.assistant-widget .chat-reply .button {
  margin: 4px 4px 4px 0;
  padding: 6px 9px;
  font-size: 11px;
}
.assistant-widget .chat-history-select {
  flex-shrink: 0;
}
.all-tickets strong {
  font-weight: 500;
  overflow-wrap: anywhere;
}
.table-box table {
  min-width: 660px;
}
.message-table {
  min-width: 800px;
}
.table-box td {
  overflow-wrap: anywhere;
}
.panel .filters {
  flex-wrap: wrap;
}
.plan-editor label {
  margin: 10px 0;
}
.plan-editor > div label {
  margin-top: 10px;
}
.note-band svg {
  vertical-align: middle;
  width: 17px;
}
.sidebar #navigation {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.sidebar .nav-label {
  flex-shrink: 0;
}
.connection-kpis {
  overflow-wrap: anywhere;
}
dialog {
  max-height: calc(100dvh - 40px);
  overflow: auto;
}
dialog .modal-summary {
  overflow-wrap: anywhere;
}
.config-row p {
  overflow-wrap: anywhere;
}
.drawer-actions {
  flex-wrap: wrap;
}
.sidebar-bottom .profile small {
  max-width: 110px;
}
.status svg {
  height: 12px;
  width: 12px;
}
.plan-manager-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
}
select,
input,
textarea {
  accent-color: var(--action);
}
.chart-meta {
  gap: 15px;
}
.chat-messages .chat-user {
  justify-content: flex-end;
}
.chat-user > div {
  white-space: normal;
}
.credential-form > label {
  max-width: 760px;
}
.credential-form .inline-check {
  font-size: 12px;
}
@media (max-width: 1100px) {
  .report-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .report-history {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .report-history > .panel-heading {
    grid-column: 1/-1;
  }
  .lower-grid {
    grid-template-columns: 1fr;
  }
  .live-schedules {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 719px) {
  .report-history {
    display: block;
  }
  .report-content {
    padding: 0 16px 20px;
  }
  .live-schedules {
    padding: 0 14px 14px;
    gap: 10px;
  }
  .schedule-preview {
    padding: 10px;
    font-size: 12px;
  }
  .schedule-preview .status {
    margin-top: 7px;
  }
  .report-content .connection-kpis strong {
    font-size: 23px;
  }
  .login-card {
    padding: 28px 22px;
  }
  .heading-actions {
    flex-wrap: wrap;
  }
  .plan-editor {
    grid-template-columns: 1fr;
  }
  .report-content .connection-kpis > div {
    padding-left: 0;
    padding-right: 10px;
  }
  .table-box {
    overflow-x: auto;
  }
  .sidebar .profile small {
    max-width: none;
  }
}

.lower-grid table {
  min-width: 0;
  table-layout: fixed;
}
.lower-grid th:first-child {
  width: 38%;
}
.lower-grid td,
.lower-grid th {
  padding-left: 12px;
  padding-right: 12px;
}
@media (max-width: 719px) {
  .lower-grid table {
    min-width: 460px;
  }
}

.staff-panel {
  scroll-margin-top: 20px;
}
.staff-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.staff-ledger-title,
.staff-controls,
.staff-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.staff-ledger-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.staff-ledger-title span,
.staff-group > span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.staff-controls {
  flex-wrap: wrap;
}
.staff-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  width: 230px;
  height: 38px;
}
.staff-search svg {
  width: 16px;
  color: var(--muted);
  flex-shrink: 0;
}
.staff-search input {
  border: 0;
  padding: 0;
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 12px;
  color: var(--navy);
  background: transparent;
}
.staff-search:focus-within {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}
.staff-search input:focus {
  outline: none;
}
.staff-group select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-size: 12px;
  max-width: 220px;
}
@media (max-width: 719px) {
  .staff-toolbar {
    padding: 16px;
    gap: 12px;
  }
  .staff-controls {
    width: 100%;
  }
  .staff-search {
    width: 100%;
  }
  .staff-group {
    flex: 1;
    min-width: 0;
  }
  .staff-group select {
    flex: 1;
    min-width: 0;
    max-width: none;
  }
}

/* Shared list controls: all record lists use the same page size and range. */
.connection-pagination {
  flex-wrap: wrap;
  gap: 12px;
}
.page-size-control,
.page-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.page-size-control {
  font-size: 12px;
  color: var(--muted);
}
.page-size-control select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  color: var(--navy);
  background: var(--white);
}
.report-history .connection-pagination > span {
  flex-basis: 100%;
}
.report-history .page-buttons {
  width: 100%;
  justify-content: flex-end;
}
.report-history > button {
  width: 100%;
}
.plan-manager {
  max-height: 55vh;
  overflow-y: auto;
}
.live-schedules {
  max-height: 260px;
  overflow-y: auto;
}
section.panel,
aside.panel {
  scroll-margin-top: 20px;
}
@media (max-width: 719px) {
  .connection-pagination > span {
    flex-basis: 100%;
  }
  .page-buttons {
    margin-left: auto;
  }
}
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.sync-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--beemax-mint-500);
}
.sync-status[data-state="syncing"] .sync-dot {
  opacity: 0.45;
}
.sync-status[data-state="failed"],
.sync-status[data-state="partial"] {
  color: var(--ink);
}
.sync-status[data-state="failed"] .sync-dot,
.sync-status[data-state="partial"] .sync-dot {
  background: currentColor;
}

.report-history > .connection-pagination {
  grid-column: 1 / -1;
}

/* Remote business queries retain their source scope and bounded list height. */
.remote-analytics {
  width: min(1080px, calc(100vw - 32px));
  max-width: 1080px;
}
.remote-query-controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.remote-query-controls label {
  flex: 1 1 180px;
}
.remote-table {
  max-height: 52vh;
  overflow: auto;
}
.remote-report-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 60vh;
  overflow: auto;
  line-height: 1.8;
}

.ai-report-metrics { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.ai-report-metrics strong { display: block; margin: 10px 0; }
.report-summary { white-space: pre-wrap; }

/* AI reports: facts first, actions second, evidence available on demand. */
.insights-tools, .report-library { position: relative; }
.insights-tools > summary, .report-library > summary {
  cursor: pointer; padding: 10px 12px; font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px; white-space: nowrap;
}
.insights-tools > div, .report-library-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 8;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px rgb(11 24 48 / 8%); padding: 12px;
}
.insights-tools > div { display: flex; gap: 8px; min-width: max-content; }
.insights-plans { margin: 8px 0 20px; border-bottom: 1px solid var(--line); }
.insights-plans > summary { display: flex; justify-content: space-between; gap: 16px; cursor: pointer; padding: 12px 0; font-size: 12px; color: var(--muted); }
.insights-plans strong { color: var(--navy); margin-left: 12px; font-weight: 500; }
.insights-plans .live-schedules { padding: 12px 0 20px; }
.report-reading { margin-top: 24px; }
.report-reading-header { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 24px 28px; border-bottom: 1px solid var(--line); }
.report-heading-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.report-reading-header h2 { font-size: 20px; margin: 0; }
.report-reading-header p { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.report-library > summary span { margin-left: 6px; color: var(--navy); }
.report-library-menu { width: min(330px, calc(100vw - 64px)); max-height: 440px; overflow-y: auto; }
.report-library-title { padding: 4px 10px 12px; font-size: 12px; color: var(--muted); }
.report-library-menu > button { display: block; width: 100%; text-align: left; padding: 12px; background: var(--white); border: 0; border-radius: 8px; color: var(--navy); }
.report-library-menu > button.active, .report-library-menu > button:hover { background: var(--blue-soft); }
.report-library-menu small { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.report-reading .report-content { padding: 0 28px 24px; }
.report-reading .ai-report-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); padding: 24px 0 20px; gap: 0; }
.report-reading .ai-report-metrics > div { padding: 0 24px; border-left: 1px solid var(--line); min-width: 0; }
.report-reading .ai-report-metrics > div:first-child { padding-left: 0; border-left: 0; }
.report-reading .ai-report-metrics > div > span { color: var(--muted); font-size: 13px; }
.report-reading .ai-report-metrics strong { display: flex; align-items: baseline; gap: 6px; font-size: 32px; font-weight: 600; line-height: 1.2; margin: 12px 0 0; font-variant-numeric: tabular-nums; }
.report-reading .ai-report-metrics small { color: var(--muted); font-size: 12px; font-weight: 400; }
.report-secondary-metrics { display: flex; flex-wrap: wrap; gap: 10px 28px; font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.report-secondary-metrics strong { color: var(--navy); font-weight: 500; margin-left: 6px; }
.report-conclusion { background: var(--soft); border-radius: 8px; padding: 18px 20px; margin: 4px 0 28px; }
.report-conclusion h3, .report-section-heading h3 { margin: 0; font-size: 15px; }
.report-conclusion .report-summary { margin: 8px 0 0; font-size: 14px; line-height: 1.85; max-width: 100ch; }
.report-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.report-section-heading h3 span { color: var(--muted); margin-left: 8px; font-weight: 400; }
.report-section-heading > span { color: var(--muted); font-size: 12px; }
.report-advice { border-top: 1px solid var(--line); }
.report-advice > summary { display: grid; grid-template-columns: 24px minmax(0,1fr) auto 16px; align-items: center; gap: 12px; list-style: none; padding: 18px 0; cursor: pointer; }
.report-advice > summary::-webkit-details-marker { display: none; }
.report-advice > summary::after { content: "+"; color: var(--muted); text-align: center; font-size: 18px; }
.report-advice[open] > summary::after { content: "−"; }
.report-advice summary > strong { font-size: 14px; font-weight: 500; line-height: 1.7; overflow-wrap: anywhere; }
.advice-number { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.advice-labels { display: flex; flex-wrap: wrap; gap: 6px; }
.report-advice-body { padding: 0 28px 20px 36px; max-width: 100ch; font-size: 13px; line-height: 1.85; }
.report-advice-body p { margin: 0 0 12px; }
.report-advice-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.report-more > summary { color: var(--blue); cursor: pointer; padding: 12px 0; font-size: 12px; }
.report-actions-section { margin-bottom: 24px; }
.report-disclosure { border-top: 1px solid var(--line); }
.report-disclosure > summary { display: flex; justify-content: space-between; gap: 12px; cursor: pointer; padding: 18px 0; font-size: 13px; }
.report-disclosure small { color: var(--muted); font-size: 12px; margin-left: 10px; }
.disclosure-hint { color: var(--muted); font-size: 12px; }
.report-disclosure[open] .disclosure-hint { font-size: 0; }
.report-disclosure[open] .disclosure-hint::after { content: "收起"; font-size: 12px; }
.report-disclosure-body { padding: 0 0 16px; font-size: 13px; line-height: 1.85; overflow-wrap: anywhere; }
.report-disclosure-body > p { color: var(--muted); margin-top: 0; }
.report-finding { padding: 14px 0; max-width: 100ch; }
.report-finding h4 { font-size: 14px; margin: 0; }
.report-finding p { margin: 8px 0; }
.report-finding small { margin: 0; }
.report-definition { padding: 12px 0; border-top: 1px solid var(--line); }
.report-definition strong { display: flex; justify-content: space-between; gap: 20px; font-weight: 500; }
.report-definition p { color: var(--muted); margin: 6px 0 0; }
@media (max-width: 719px) {
  .report-reading-header { padding: 20px; align-items: flex-start; flex-wrap: wrap; }
  .report-reading-header p span { display: block; margin-top: 4px; }
  .report-reading .report-content { padding: 0 20px 16px; }
  .report-reading .ai-report-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); row-gap: 24px; }
  .report-reading .ai-report-metrics > div { padding: 0 16px; }
  .report-reading .ai-report-metrics > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .report-reading .ai-report-metrics strong { font-size: 28px; }
  .report-section-heading > span { display: none; }
  .report-advice > summary { grid-template-columns: 20px minmax(0,1fr) 16px; gap: 8px; }
  .advice-labels { grid-column: 2; }
  .advice-labels:empty { display: none; }
  .report-advice > summary::after { grid-column: 3; grid-row: 1; }
  .report-advice-body { padding-left: 28px; padding-right: 0; }
  .report-conclusion { padding: 16px; }
  .report-library-menu { left: 0; right: auto; }
  .insights-plans > summary { flex-wrap: wrap; gap: 6px; }
}

/* Readable AI replies and truthful request state. */
.chat-reply, .chat-reply > div { min-width: 0; max-width: 100%; }
.chat-message-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 12px; }
.chat-message-heading > strong { font-size: 13px; }
.chat-message-heading time { font-size: 11px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.chat-message-status { font-size: 11px; color: var(--muted); }
.chat-message-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 11px; margin-top: 12px; }
.assistant-widget .chat-markdown { white-space: normal; font-size: 13px; line-height: 1.8; }
.chat-markdown > :first-child { margin-top: 0; }
.chat-markdown > :last-child { margin-bottom: 0; }
.chat-markdown p { margin: 10px 0; }
.chat-markdown h2, .chat-markdown h3, .chat-markdown h4, .chat-markdown h5, .chat-markdown h6 { font-size: 15px; line-height: 1.6; margin: 20px 0 10px; font-weight: 600; }
.chat-markdown h2 { font-size: 17px; }
.chat-markdown ul, .chat-markdown ol { margin: 10px 0; padding-left: 22px; }
.chat-markdown li { margin: 5px 0; }
.chat-markdown blockquote { border-left: 2px solid var(--line); padding: 8px 12px; margin: 12px 0; color: var(--muted); background: var(--soft); }
.chat-markdown hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.chat-markdown code { background: var(--soft); border-radius: 4px; padding: 2px 4px; font-size: 12px; }
.chat-markdown pre { background: var(--soft); padding: 12px; overflow-x: auto; border-radius: 8px; }
.chat-markdown pre code { padding: 0; white-space: pre; }
.chat-table-scroll { max-width: 100%; overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 8px; }
.chat-markdown table { width: 100%; border-collapse: collapse; font-size: 12px; }
.chat-markdown th, .chat-markdown td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.chat-markdown th { background: var(--soft); font-weight: 500; color: var(--muted); }
.chat-markdown tr:last-child td { border-bottom: 0; }
.chat-ticket-status { display: inline-block; border-radius: 4px; padding: 1px 6px; background: var(--blue-soft); color: var(--navy); font-size: 11px; }
.chat-sources { margin-top: 14px; color: var(--muted); font-size: 11px; }
.chat-sources summary { cursor: pointer; }
.chat-sources p { line-height: 1.7; overflow-wrap: anywhere; }
.chat-request-state { margin: 18px 0; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.chat-request-state > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; }
.chat-request-state [data-chat-elapsed] { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-request-state p { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 8px 0; }
.chat-state-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.chat-request-state[data-status="failed"] .chat-state-dot, .chat-request-state[data-status="stopped"] .chat-state-dot { background: var(--muted); }
.chat-request-state[data-status="pending"] .chat-state-dot { animation: chat-wait 1.4s ease-in-out infinite; }
@keyframes chat-wait { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .chat-request-state[data-status="pending"] .chat-state-dot { animation: none; } }

/* QiWe credential editor follows the three-row reference layout. */
/* QiWe uses the same panel and heading grid as the other configuration tabs. */
.qiwe-heading { gap:16px; flex-wrap:wrap; }
.qiwe-heading-actions { display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
.qiwe-fields { padding:2px 22px 20px; }
.qiwe-field { display:grid; grid-template-columns:110px minmax(0,1fr); align-items:start; gap:20px; max-width:760px; margin-top:20px; }
.qiwe-field>label { font-size:13px; font-weight:500; padding-top:11px; }
.qiwe-input-wrap { position:relative; }
.qiwe-input-wrap input { display:block; width:100%; min-width:0; padding:10px 44px 10px 12px; border:1px solid var(--line); border-radius:8px; background:var(--soft); color:var(--navy); font:inherit; font-size:13px; }
.qiwe-field small { display:block; margin-top:6px; color:var(--muted); font-size:11px; line-height:1.7; overflow-wrap:anywhere; }
.qiwe-reveal { position:absolute; top:2px; right:2px; width:36px; height:36px; display:grid; place-items:center; border:0; border-radius:6px; background:transparent; color:var(--muted); cursor:pointer; }
.qiwe-reveal svg { width:19px; height:19px; }
.qiwe-reveal:hover,.qiwe-reveal[aria-pressed="true"] { background:var(--blue-soft); color:var(--action); }
.qiwe-form-actions { padding:16px 22px; border-top:1px solid var(--line); display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.qiwe-form-actions>span { margin-right:auto; color:var(--muted); font-size:11px; }
.qiwe-current-config { padding:20px 22px 22px; border-top:1px solid var(--line); }
.qiwe-current-heading h3 { margin:0 0 5px; font-size:14px; font-weight:600; }
.qiwe-current-heading p { margin:0; color:var(--muted); font-size:11px; line-height:1.7; }
.qiwe-current-config .table-box { margin-top:14px; border:1px solid var(--line); border-radius:8px; overflow-x:auto; }
.qiwe-current-table { min-width:720px; }
.qiwe-current-table td { height:64px; }
.qiwe-current-table strong { font-size:12px; font-weight:550; }
.qiwe-current-table small { margin-top:4px; }
.qiwe-not-configured { color:var(--muted); }
.qiwe-connection-meta { padding:18px 22px; }
.qiwe-readonly { padding:0 22px 20px; color:var(--muted); font-size:13px; line-height:2.5; }
@media(max-width:719px) {
  .qiwe-fields { padding:0 18px 18px; }
  .qiwe-field { grid-template-columns:minmax(0,1fr); gap:6px; margin-top:18px; }
  .qiwe-field>label { padding-top:0; }
  .qiwe-form-actions { padding:16px 18px; justify-content:flex-end; }
  .qiwe-form-actions>span { width:100%; margin-bottom:4px; }
  .qiwe-current-config { padding:18px; }
  .qiwe-connection-meta { padding:18px; flex-wrap:wrap; }
  .qiwe-readonly { padding:0 18px 18px; }
}

.whitelist-types { display: flex; flex-wrap: wrap; gap: 12px; padding: 0 24px 20px; }
.whitelist-id { overflow-wrap: anywhere; max-width: 300px; }

.account-whitelist { margin-top: 32px; scroll-margin-top: 88px; }
.account-whitelist > .config-title { padding-left: 0; padding-right: 0; }
.whitelist-account { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.whitelist-account select { max-width: 280px; }

.whitelist-scope { overflow-wrap: anywhere; margin: 0 0 16px; color: var(--muted); line-height: 1.8; }

.notification-settings { border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.notification-scope { padding: 0 24px 20px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.notification-scope p { color: var(--muted); font-size: 13px; flex: 1; min-width: 220px; }
.notification-members { display: flex; gap: 8px; flex-wrap: wrap; max-width: 620px; }
.notification-person { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; background: var(--soft); border-radius: 4px; }
.notification-person button { min-width: 24px; min-height: 24px; }

.notification-options { border: 1px solid var(--line); border-radius: 8px; max-height: 280px; overflow-y: auto; }
.notification-options label { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.notification-options label input { width: auto; margin: 0; }
.notification-options small { display: block; color: var(--muted); overflow-wrap: anywhere; }

.notification-options label:has(textarea) { display: block; }
.notification-options textarea { display: block; width: 100%; margin-top: 8px; }
.exclusion-editor { border: 0; padding: 0; margin: 20px 0 0; min-width: 0; }
.exclusion-editor legend { font-weight: 600; margin-bottom: 12px; }
.exclusion-editor .note-band p { margin: 4px 0 0; }
.exclusion-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.exclusion-inputs input { width: 100%; min-width: 0; }
.exclusion-list { max-height: 180px; overflow-y: auto; }
.exclusion-person { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.exclusion-person span { min-width: 0; overflow-wrap: anywhere; }
.exclusion-person small { display: block; color: var(--muted); }
.exclusion-person button { flex-shrink: 0; }
.exclusion-preview { overflow-wrap: anywhere; }
@media (max-width: 540px) { .exclusion-inputs { grid-template-columns: 1fr; gap: 0; } }

.overview-dimensions { margin-top: 28px; }
.dimension-heading { padding: 0; margin-bottom: 20px; align-items: center; }
.overview-dimensions .panel-heading p { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.dimension-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; }
.dimension-grid > .panel { min-width: 0; display: flex; flex-direction: column; }
.dimension-grid .panel-footer { margin-top: auto; }
.dimension-bars { padding: 24px; display: grid; gap: 22px; }
.dimension-bar { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(60px, 1.3fr) auto; gap: 16px; align-items: center; }
.dimension-bar > span:first-child { overflow-wrap: anywhere; }
.dimension-bar > span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.dimension-bar small { display: block; color: var(--muted); font-size: 12px; }
.dimension-track { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.dimension-track i { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.dimension-grid .table-box { margin-top: 16px; }
.dimension-grid td { white-space: nowrap; }
.dimension-method { padding: 12px 24px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); margin-top: auto; }
.dimension-method summary { cursor: pointer; }
.hour-scroll { padding: 24px; overflow-x: auto; }
.hour-chart { min-width: 440px; display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 4px; }
.hour-column { min-width: 0; text-align: center; border-radius: 4px; font-size: 10px; font-variant-numeric: tabular-nums; }
.hour-column > span { display: block; height: 18px; }
.hour-column > div { height: 140px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); }
.hour-column i { display: block; width: 70%; background: var(--blue); border-radius: 3px 3px 0 0; }
.hour-column small { display: block; margin-top: 8px; color: var(--muted); }
.hour-column:hover { background: var(--blue-soft); }
.dimension-filter { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; margin-bottom: 18px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; }
.dimension-filter a { white-space: nowrap; }
@media (max-width: 1100px) { .dimension-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 540px) { .dimension-heading { align-items: flex-start; gap: 12px; flex-direction: column; } .dimension-bars { padding: 18px; } .dimension-bar { gap: 10px; } .dimension-filter { align-items: flex-start; flex-direction: column; } }
.dimension-grid table { min-width: 460px; }
.dimension-grid th, .dimension-grid td { padding: 12px 10px; font-size: 12px; }
.dimension-grid th:first-child, .dimension-grid td:first-child { padding-left: 16px; }
.dimension-grid th:last-child, .dimension-grid td:last-child { padding-right: 16px; }

.trend-details { margin-top: 24px; }
.trend-range-note { font-size: 12px; color: var(--muted); margin:16px 0 0; }
.trend-range-note summary, .trend-ledger summary { cursor: pointer; }
.trend-detail-grid { align-items:start; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; }
.trend-detail-grid > .panel { min-width: 0; display: flex; flex-direction: column; }
.trend-detail-grid .panel-heading p { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.trend-detail-grid .panel-footer { margin-top: auto; }
.trend-chart-scroll { overflow-x: auto; padding: 22px 16px 12px; }
.detail-line-chart, .detail-net-chart { display: block; width: 100%; min-width: 380px; }
.detail-line-chart text, .detail-net-chart text { font-size: 11px; fill: var(--muted); }
.detail-grid { stroke: var(--line); }
.detail-zero { stroke: var(--muted); stroke-width: 1; }
.detail-series { fill: none; stroke-width: 2; }
.series-0 { stroke: var(--blue); }
.series-1 { stroke: var(--navy); stroke-dasharray: 6 4; }
.series-2 { stroke: var(--muted); stroke-dasharray: 2 4; }
.detail-point { fill: var(--white); stroke-width: 2; stroke-dasharray: none; }
.detail-line-chart a:focus circle, .detail-line-chart a:hover circle { stroke-width: 4; }
.net-positive { fill: var(--blue); }
.net-negative { fill: var(--navy); }
.trend-ledger { border-top: 1px solid var(--line); padding: 12px 16px; font-size: 12px; }
.trend-ledger table { min-width: 380px; }
.trend-ledger th, .trend-ledger td { padding: 10px; }
.trend-group-picker { padding: 16px 24px 0; display: flex; flex-wrap: wrap; gap: 12px 18px; max-height: 125px; overflow-y: auto; }
.trend-group-picker label { display: flex; gap: 7px; align-items: center; font-size: 12px; }
.trend-group-picker input { margin: 0; }
.detail-legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 24px 0; font-size: 12px; }
.detail-legend span { display: inline-flex; align-items: center; gap: 7px; }
.detail-legend i { width: 18px; border-top: 2px solid var(--blue); }
.detail-legend .series-1 { border-color: var(--navy); border-top-style: dashed; }
.detail-legend .series-2 { border-color: var(--muted); border-top-style: dotted; }
.trend-distribution { padding: 20px 24px; display: grid; gap: 20px; }
.trend-distribution-row { display: grid; grid-template-columns: minmax(80px,1fr) auto minmax(115px,auto); align-items: center; gap: 16px; font-size: 12px; }
.trend-distribution-row strong { font-weight: 500; overflow-wrap: anywhere; }
.trend-distribution-row .dimension-track { margin-top: 10px; }
.trend-distribution-row small { display: block; color: var(--muted); margin-top: 4px; }
.trend-distribution-row > div:not(:first-child) { text-align: right; }
@media(max-width:1100px) { .trend-detail-grid { grid-template-columns: minmax(0,1fr); } }
@media(max-width:540px) { .trend-distribution { padding: 16px; } .trend-distribution-row { grid-template-columns: minmax(0,1fr) auto; } .record-comparison { grid-column: 1 / -1; text-align: left !important; } }

.advice-followup { margin-top:24px; }
.followup-counts { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); margin:0 22px; padding:4px 0 20px; }
.followup-counts>button { padding:0 24px; border-right:1px solid var(--line); }
.followup-counts>button:first-child { padding-left:0; }
.followup-counts>button:last-child { border:0; }
.followup-counts span { color:var(--muted); font-size:12px; }
.followup-counts strong { display:block; font-size:30px; font-weight:600; margin-top:8px; }
.followup-counts small { font-size:11px; color:var(--muted); font-weight:400; margin-left:6px; }
.followup-note { margin:0 22px 20px; font-size:11px; color:var(--muted); }
.followup-list-heading { border-top:1px solid var(--line); padding:18px 22px; display:flex; justify-content:space-between; align-items:center; gap:12px; }
.followup-list-heading h3 { margin:0; font-size:14px; }
.followup-list-heading span,.followup-completed { color:var(--muted); font-size:11px; }
.followup-table { min-width:820px; table-layout:fixed; }
.followup-table th:first-child { width:42%; }
.followup-table td { vertical-align:top; }
.followup-table td>strong { display:block; font-weight:500; overflow-wrap:anywhere; }
.followup-table details { margin-top:8px; }
.followup-table summary { cursor:pointer; color:var(--action); font-size:11px; }
.followup-table details p { white-space:normal; overflow-wrap:anywhere; font-size:12px; line-height:1.8; }
.followup-table .followup-due { display:block; color:var(--action); }
@media(max-width:719px) {
  .followup-counts { margin:0 18px; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px 0; }
  .followup-counts>button { padding:0 18px; }
  .followup-counts>button:nth-child(odd) { padding-left:0; }
  .followup-counts>button:nth-child(even) { border:0; }
  .followup-note { margin:0 18px 18px; }
  .followup-list-heading { padding:18px; flex-wrap:wrap; }
}

.trend-section-heading { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:18px; }
.trend-section-heading h2 { margin:0; font-size:18px; font-weight:600; }
.trend-section-heading p { margin:6px 0 0; color:var(--muted); font-size:12px; }
.trend-view-switch { flex-shrink:0; }
.trend-view-switch button { padding:8px 14px; font-size:12px; white-space:nowrap; }
@media(max-width:719px) {
  .trend-section-heading { align-items:stretch; flex-direction:column; gap:14px; }
  .trend-view-switch { width:100%; }
  .trend-view-switch button { flex:1; padding:8px; }
}

.followup-counts>button { text-align:left; font:inherit; color:var(--navy); background:transparent; border:0; border-right:1px solid var(--line); cursor:pointer; border-radius:4px; }
.followup-counts>button:hover { background:var(--soft); }
.followup-counts>button.active { background:var(--blue-soft); box-shadow:inset 0 -2px var(--action); }
.followup-counts>button.active span { color:var(--action); }
.followup-counts>button:last-child { border-right:0; }
.report-highlights { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:0; padding:20px 0 24px; }
.report-highlights>div { padding:0 22px; border-right:1px solid var(--line); }
.report-highlights>div:first-child { padding-left:0; }
.report-highlights>div:last-child { border-right:0; }
.report-highlights span { font-size:12px; color:var(--muted); }
.report-highlights p { font-size:13px; line-height:1.9; margin:10px 0 0; overflow-wrap:anywhere; }
@media(max-width:719px) {
  .report-highlights { grid-template-columns:1fr; gap:18px; }
  .report-highlights>div { padding:0; border-right:0; }
  .followup-counts>button:nth-child(even) { border-right:0; }
}

.migration-banner{padding:12px 16px;margin-bottom:24px;border:1px solid #eeddb5;border-radius:10px;background:#fffaf0;color:#755b22;font-size:13px;line-height:1.7}

/* Native WeCom pages use the same Serva shell, type scale and table components. */
.wc-account-row{display:grid;grid-template-columns:minmax(220px,1.3fr) minmax(180px,1fr) minmax(100px,.65fr) auto;gap:28px;align-items:center;padding:28px 24px;border-top:1px solid var(--line)}
.wc-account-name{display:flex;align-items:center;gap:16px;min-width:0}
.wc-account-name>div{min-width:0;overflow-wrap:anywhere}.wc-account-name h3{font-size:16px;margin:0 0 6px;font-weight:600;color:var(--navy)}
.wc-account-name span:not(.wc-account-avatar):not(.status){font-size:12px;color:var(--muted)}
.wc-account-avatar{display:grid;place-items:center;width:48px;height:48px;border-radius:14px;background:var(--blue-soft);color:var(--action);font-size:20px;font-weight:600;flex-shrink:0}
.wc-badges{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}
.wc-status{white-space:nowrap;line-height:1.5}.wc-status.wc-success{color:#008d68;background:#eaf8f1}.wc-status.wc-error{color:#b84444;background:#fff0f0}.wc-status.wc-pending{color:#95671d;background:#fff7e9}.wc-status.wc-blue{color:var(--action);background:var(--blue-soft)}
.wc-account-fact{min-width:0;display:flex;flex-direction:column;gap:8px}.wc-account-fact small{font-size:11px;color:var(--muted);overflow-wrap:anywhere}.wc-account-fact strong{font-size:14px;font-weight:500;overflow-wrap:anywhere}.wc-account-fact em{font-size:11px;font-style:normal;color:var(--muted)}.wc-account-fact button{text-align:left;font-size:12px}
.wc-account-actions{display:flex;flex-direction:column;align-items:flex-end;gap:12px}
.wc-footnote{display:flex;align-items:center;gap:7px;font-size:11px;line-height:1.8;color:var(--muted);margin:18px 0}.wc-footnote svg{width:14px;height:14px;flex-shrink:0}
.wc-alert{display:flex;gap:12px;align-items:center;margin:0 0 20px;padding:14px 18px;border:1px solid #eeddb5;background:#fffaf0;border-radius:10px;font-size:12px;line-height:1.7;color:#755b22}.wc-alert span{flex:1}.wc-alert svg{flex-shrink:0}.wc-alert .button{background:transparent}
.wc-empty{padding:64px 24px;display:flex;gap:12px;align-items:center;justify-content:center;color:var(--muted);font-size:13px}.wc-loader{width:16px;height:16px;border:2px solid var(--line);border-top-color:var(--action);border-radius:50%;animation:wc-spin .8s linear infinite}@keyframes wc-spin{to{transform:rotate(360deg)}}
.wc-log-filters{padding:20px 24px;display:flex;gap:10px;flex-wrap:wrap;border-bottom:1px solid var(--line);align-items:center}.wc-log-filters .staff-search{flex:1 1 280px}.wc-log-filters select,.wc-detail-tabs select{padding:9px 12px;border:1px solid var(--line);border-radius:8px;font:inherit;font-size:12px;background:var(--white);color:var(--navy);max-width:220px}
.wc-log-table{table-layout:fixed;min-width:820px}.wc-log-table th:nth-child(1){width:155px}.wc-log-table th:nth-child(2){width:175px}.wc-log-table th:nth-child(4){width:105px}.wc-log-table th:nth-child(5){width:78px}.wc-log-table td{vertical-align:top!important;padding-top:18px!important;padding-bottom:18px!important}
.wc-time{font-variant-numeric:tabular-nums;font-size:12px}.wc-message-cell p{margin:8px 0 0;font-size:13px;line-height:1.7;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.wc-kind{font-size:10px;color:var(--muted);letter-spacing:.04em}.wc-wrap{overflow-wrap:anywhere}.wc-quote{padding-left:8px;border-left:2px solid var(--line);display:block;margin-top:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wc-service-row{display:flex;align-items:center;gap:16px;padding:20px 24px;border-top:1px solid var(--line)}.wc-service-row>div:first-child{flex:1}.wc-service-row strong{font-size:13px}.wc-service-row p{margin:6px 0 0;color:var(--muted);font-size:12px}
.wc-detail-tabs{display:flex;gap:28px;padding:0 24px;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.wc-detail-tabs button{border:0;background:none;color:var(--muted);border-bottom:2px solid transparent;padding:16px 0;font:inherit;font-size:13px;cursor:pointer}.wc-detail-tabs button[aria-selected=true]{border-bottom-color:var(--action);color:var(--action);font-weight:600}.wc-detail-tabs span{font-size:11px;padding:2px 6px;background:var(--soft);border-radius:4px;margin-left:5px}
.wc-inline{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.wc-detail-grid{display:grid;grid-template-columns:95px minmax(0,1fr);gap:12px;font-size:12px;margin:24px 0;line-height:1.7}.wc-detail-grid dt{color:var(--muted)}.wc-detail-grid dd{margin:0;overflow-wrap:anywhere}
.wc-full-message{padding:18px;background:var(--soft);border:1px solid var(--line);border-radius:8px;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.8;max-height:380px;overflow:auto;margin-bottom:18px}.wc-manage-actions{display:grid;gap:10px}.wc-manage-actions button[data-wc=delete]{color:#b84444;border-color:#efd8d8;margin-top:10px}.wc-send-note{font-size:12px;color:var(--muted);line-height:1.8}
.wc-qr-heading{text-align:center;margin:28px 0 20px}.wc-qr-heading>svg{width:28px;height:28px;color:var(--action)}.wc-qr-heading h3{font-size:17px;margin:12px 0 8px}.wc-qr-heading p,.wc-qr-expiry,.wc-qr-success{text-align:center;font-size:12px;color:var(--muted);line-height:1.8}.wc-qr-image{display:flex;justify-content:center;padding:16px}.wc-qr-image img{width:220px;height:220px;object-fit:contain;background:white;padding:10px;border:1px solid var(--line);border-radius:12px}.wc-qr-create{width:100%;margin-top:18px}[data-qr-cancel]{display:block;margin:18px auto}
@media(max-width:1100px){.wc-account-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:24px}.wc-account-actions{flex-direction:row;align-items:center}.wc-account-fact strong{font-size:13px}}
@media(max-width:719px){.wc-account-row{grid-template-columns:minmax(0,1fr);padding:22px 18px;gap:20px}.wc-account-fact{gap:6px}.wc-account-actions{justify-content:flex-start;flex-wrap:wrap}.wc-log-filters{padding:16px;gap:8px}.wc-log-filters select{flex:1 1 40%;max-width:none;min-width:0}.wc-log-filters .staff-search{flex-basis:100%}.wc-service-row{flex-wrap:wrap;padding:18px}.wc-service-row>div:first-child{flex-basis:100%}.wc-detail-tabs{padding:0 18px}.wc-alert{align-items:flex-start}.wc-accounts .staff-toolbar{gap:14px}.wc-accounts .staff-search{min-width:0}.wc-detail-grid{grid-template-columns:80px minmax(0,1fr)}}
@media(prefers-reduced-motion:reduce){.wc-loader{animation:none}}

/* Message pipeline health, scoped to the native monitoring page. */
.link-health-page { --lh-green: #23755c; --lh-amber: #9b6815; --lh-red: #b64042; }
.lh-toolbar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin: 0 0 24px; }
.lh-toolbar > label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.lh-toolbar select, .lh-trace-filters select { padding: 10px 32px 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); color: var(--ink); font: inherit; min-width: 146px; }
.lh-toolbar .lh-auto { margin-left: auto; white-space: nowrap; }
.lh-auto input { accent-color: var(--action); width: 15px; height: 15px; }
.lh-last { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.lh-overview { display: flex; align-items: center; gap: 18px; padding: 22px 24px; background: #f1f6f4; border: 1px solid #dce9e2; border-radius: 10px; margin-bottom: 24px; }
.lh-overview.lh-warning { background: #fbf7ee; border-color: #eadfc5; }
.lh-overview.lh-error { background: #fbf1f0; border-color: #edd8d6; }
.lh-overview.lh-unknown { background: var(--soft); border-color: var(--line); }
.lh-overview-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #fff9; color: var(--lh-green); flex-shrink: 0; }
.lh-overview.lh-warning .lh-overview-icon { color: var(--lh-amber); }
.lh-overview.lh-error .lh-overview-icon { color: var(--lh-red); }
.lh-overview h2 { font-size: 17px; margin: 0 0 5px; }
.lh-overview p { color: var(--muted); font-size: 12px; margin: 0; line-height: 1.8; }
.lh-overview > .lh-badge { margin-left: auto; flex-shrink: 0; }
.lh-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
.lh-badge > span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.lh-badge.lh-healthy { color: var(--lh-green); }
.lh-badge.lh-warning { color: var(--lh-amber); }
.lh-badge.lh-error { color: var(--lh-red); }
.lh-chain-panel, .lh-ledger { margin-top: 24px; overflow: hidden; }
.lh-section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px; }
.lh-section-title h2 { font-size: 16px; margin: 0 0 6px; }
.lh-section-title p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.lh-backend { border: 1px solid var(--line); border-radius: 5px; padding: 5px 9px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.lh-chain { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; padding: 0 24px 24px; align-items: start; }
.lh-stage { position: relative; border: 1px solid var(--line); border-radius: 8px; min-width: 0; background: var(--white); }
.lh-stage:not(:last-child)::after { content: '→'; position: absolute; right: -15px; top: 58px; font-size: 13px; color: #a3aab1; }
.lh-stage.lh-error { border-color: #e8c6c6; background: #fffafa; }
.lh-stage.lh-warning { border-color: #e8d9b9; background: #fffcf6; }
.lh-stage summary { cursor: pointer; list-style: none; padding: 16px; }
.lh-stage summary::-webkit-details-marker, .lh-trace summary::-webkit-details-marker { display: none; }
.lh-stage summary > strong { display: block; font-size: 13px; margin-bottom: 10px; }
.lh-stage summary > small { display: block; color: var(--muted); font-size: 10px; margin-top: 12px; font-variant-numeric: tabular-nums; }
.lh-stage-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.lh-stage-top .icon { color: var(--muted); width: 17px; height: 17px; }
.lh-stage.lh-healthy .lh-stage-top .icon { color: var(--lh-green); }
.lh-stage.lh-warning .lh-stage-top .icon { color: var(--lh-amber); }
.lh-stage.lh-error .lh-stage-top .icon { color: var(--lh-red); }
.lh-stage-number { color: var(--muted); font-size: 11px; font-family: ui-monospace, monospace; }
.lh-stage > p { margin: 0; padding: 0 16px 16px; font-size: 11px; line-height: 1.9; color: var(--muted); }
.lh-config { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); background: var(--soft); padding: 13px 24px; font-size: 11px; color: var(--muted); }
.lh-config a { margin-left: auto; color: var(--action); display: inline-flex; align-items: center; gap: 6px; }
.lh-config .icon { width: 13px; height: 13px; }
.lh-trace-filters { display: flex; padding: 0 24px 18px; gap: 14px; }
.lh-search { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); padding: 0 12px; border-radius: 7px; flex: 1; max-width: 480px; }
.lh-search .icon { width: 16px; color: var(--muted); }
.lh-search input { width: 100%; padding: 10px 0; border: 0; outline: 0; font: inherit; font-size: 12px; background: transparent; min-width: 0; }
.lh-search:focus-within { outline: 2px solid var(--action); outline-offset: 2px; }
.lh-ledger-caption { display: flex; justify-content: space-between; gap: 16px; padding: 0 24px 14px; color: var(--muted); font-size: 11px; }
.lh-ledger-head, .lh-trace > summary { display: grid; grid-template-columns: 145px minmax(120px, 1fr) 100px 150px 16px; gap: 14px; padding: 16px 24px; align-items: center; }
.lh-ledger-head { background: var(--soft); color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }
.lh-trace > summary { list-style: none; cursor: pointer; border-top: 1px solid var(--line); font-size: 12px; }
.lh-trace > summary:hover { background: var(--soft); }
.lh-trace-time { font-variant-numeric: tabular-nums; font-size: 11px; }
.lh-trace summary small { display: block; font-size: 10px; color: var(--muted); margin-top: 6px; }
.lh-trace-id { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; }
.lh-trace-id small { overflow: hidden; text-overflow: ellipsis; }
.lh-chevron { color: var(--muted); transition: transform .15s; }
.lh-trace[open] .lh-chevron { transform: rotate(180deg); }
.lh-trace-body { background: var(--soft); padding: 24px; border-top: 1px solid var(--line); }
.lh-steps { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 24px; gap: 22px; }
.lh-steps li { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.lh-step-number { display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; width: 27px; height: 27px; background: var(--white); font-size: 11px; }
.lh-steps .lh-healthy .lh-step-number { color: var(--lh-green); border-color: #c8dfd4; }
.lh-steps .lh-warning .lh-step-number { color: var(--lh-amber); border-color: #e8d9b9; }
.lh-steps .lh-error .lh-step-number { color: var(--lh-red); border-color: #e8c6c6; }
.lh-steps small { display: block; color: var(--muted); font-size: 10px; margin-top: 5px; }
.lh-diagnosis { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; font-size: 12px; }
.lh-diagnosis strong { font-size: 11px; }
.lh-diagnosis p { line-height: 1.9; color: var(--muted); margin: 7px 0 18px; }
.lh-identifiers { margin: 0; padding-top: 12px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 12px 28px; }
.lh-identifiers dt { color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.lh-identifiers dd { margin: 0; font: 11px/1.7 ui-monospace, monospace; overflow-wrap: anywhere; user-select: all; }
.lh-pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--line); }
.lh-pagination > span { font-size: 11px; color: var(--muted); margin-right: auto; }
.lh-empty { display: flex; align-items: center; flex-direction: column; justify-content: center; min-height: 220px; padding: 36px 24px; text-align: center; }
.lh-empty > .icon { color: var(--muted); width: 26px; height: 26px; margin-bottom: 16px; }
.lh-empty strong, .lh-empty h2 { font-size: 15px; }
.lh-empty p { font-size: 12px; color: var(--muted); max-width: 520px; line-height: 1.9; }
.lh-alert { display: flex; align-items: center; gap: 14px; background: #fbf1f0; border: 1px solid #edd8d6; border-radius: 8px; padding: 16px 20px; margin-bottom: 20px; color: var(--lh-red); font-size: 12px; }
.lh-alert p { margin: 5px 0 0; line-height: 1.7; }
.lh-alert button { margin-left: auto; flex-shrink: 0; }
.lh-footnote { margin: 24px 0 0; color: var(--muted); font-size: 11px; }
.lh-footnote strong { font-size: 11px; }
.lh-footnote p { line-height: 1.9; margin-top: 6px; }
.link-health-page summary:focus-visible, .link-health-page select:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
@media (max-width: 1150px) {
  .lh-chain { gap: 12px; padding: 0 18px 18px; }
  .lh-stage summary { padding: 12px; }
  .lh-stage:not(:last-child)::after { right: -11px; font-size: 10px; }
  .lh-ledger-head, .lh-trace > summary { grid-template-columns: 120px minmax(100px, 1fr) 90px 135px 12px; gap: 10px; }
  .lh-last { width: 100%; }
}
@media (max-width: 760px) {
  .lh-toolbar { gap: 12px; }
  .lh-toolbar > label:not(.lh-auto) { flex: 1 1 calc(50% - 12px); flex-direction: column; align-items: stretch; gap: 6px; }
  .lh-toolbar select { min-width: 0; width: 100%; }
  .lh-toolbar .lh-auto { margin-left: 0; }
  .lh-last { width: auto; margin-left: auto; }
  .lh-overview { padding: 18px; flex-wrap: wrap; gap: 12px; }
  .lh-overview > div:nth-child(2) { flex: 1; min-width: 180px; }
  .lh-overview > .lh-badge { margin-left: 54px; }
  .lh-chain { grid-template-columns: 1fr; gap: 14px; }
  .lh-stage summary { display: grid; grid-template-columns: 30px 1fr 110px; gap: 8px; align-items: center; }
  .lh-stage-top { margin: 0; }
  .lh-stage-top .icon { display: none; }
  .lh-stage summary > strong { margin: 0; }
  .lh-stage summary > small { grid-column: 2 / 4; margin: 0; }
  .lh-stage:not(:last-child)::after { content: '↓'; right: 50%; top: auto; bottom: -14px; }
  .lh-stage > p { padding: 0 12px 12px 50px; }
  .lh-section-title { padding: 18px; align-items: flex-start; }
  .lh-backend { white-space: normal; }
  .lh-config { padding: 12px 18px; gap: 10px; }
  .lh-config a { margin-left: 0; }
  .lh-trace-filters { padding: 0 18px 14px; flex-direction: column; }
  .lh-search { max-width: none; }
  .lh-ledger-caption { padding: 0 18px 14px; flex-direction: column; gap: 5px; }
  .lh-ledger-head { display: none; }
  .lh-trace > summary { padding: 16px 18px; grid-template-columns: minmax(0, 1fr) auto 12px; gap: 10px; }
  .lh-trace-time { grid-column: 1; display: flex; gap: 8px; align-items: center; }
  .lh-trace-time small { margin: 0; }
  .lh-trace-id { grid-column: 1; grid-row: 2; }
  .lh-trace > summary > span:nth-child(3) { grid-row: 2; grid-column: 2; font-size: 10px; color: var(--muted); }
  .lh-trace > summary > .lh-badge { grid-row: 1; grid-column: 2; }
  .lh-chevron { grid-row: 1 / 3; grid-column: 3; }
  .lh-trace-body { padding: 18px; }
  .lh-diagnosis, .lh-identifiers { grid-template-columns: 1fr; gap: 0; }
  .lh-identifiers { gap: 12px; }
  .lh-steps { flex-direction: column; gap: 12px; }
  .lh-alert { align-items: flex-start; }
}

/* QiWe directory-backed proactive group permission switches. */
.wc-target-filters{display:flex;gap:12px;padding:0 24px 18px;flex-wrap:wrap;align-items:center}
.wc-target-filters .staff-search{flex:1;max-width:420px;min-width:220px}
.wc-target-filters select{padding:10px 14px;border:1px solid var(--line);border-radius:8px;background:var(--white);color:var(--navy);font-size:12px}
.wc-group-summary{display:flex;justify-content:space-between;gap:14px;flex-wrap:wrap;padding:0 24px 16px;color:var(--muted);font-size:11px}
.wc-group-toggle{display:flex;justify-content:flex-end;align-items:center;gap:12px;white-space:nowrap}
.wc-group-toggle>span{font-size:12px;color:var(--muted)}
.wc-group-switch{position:relative;display:inline-flex;align-items:center;flex-shrink:0;width:42px;height:24px;border:1px solid transparent;border-radius:20px;padding:3px;background:#9ba5b3;cursor:pointer;transition:background .15s}
.wc-group-switch>span{width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0002;transition:transform .15s;pointer-events:none}
.wc-group-switch[aria-checked=true]{background:var(--action)}
.wc-group-switch[aria-checked=true]>span{transform:translateX(16px)}
.wc-group-switch:disabled{opacity:.5;cursor:not-allowed}
.wc-group-switch:focus-visible{outline:3px solid var(--action);outline-offset:3px}
.wc-catalog-note{color:#996614!important;font-size:11px!important;margin-top:5px!important}
@media(max-width:719px){.wc-target-filters{padding:0 18px 16px}.wc-target-filters .staff-search{min-width:0;max-width:none;flex-basis:100%}.wc-group-summary{padding:0 18px 16px}.wc-group-toggle{gap:8px}#wc-target-list table{min-width:580px}}
@media(prefers-reduced-motion:reduce){.wc-group-switch,.wc-group-switch>span{transition:none}}
/* Guest archives reuse the platform's ledger, modal and pagination patterns. */
.module-tabs > button { border: 0; background: none; padding: 12px 18px; color: inherit; cursor: pointer; font: inherit; }
.module-tabs > button.active { color: #2856a8; box-shadow: inset 0 -2px #2856a8; font-weight: 600; }
.guest-panel .staff-controls { flex-wrap: wrap; }
.guest-empty { padding: 64px 24px; text-align: center; }
.guest-empty p { color: #758092; line-height: 1.9; margin: 12px 0 24px; }
.guest-empty .button + .button { margin-left: 10px; }
.guest-empty-icon { display: inline-flex; padding: 18px; border-radius: 18px; background: #f0f4fa; color: #3e5e89; margin-bottom: 16px; }
.guest-empty-icon .icon { width: 30px; height: 30px; }
.guest-table { min-width: 900px; }
.guest-name { text-align: left; max-width: 220px; white-space: normal; }
.guest-notes { max-width: 270px; }
.guest-notes > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.guest-warning { color: #986317; font-size: 12px; }
.guest-dialog { width: min(680px, calc(100vw - 32px)); }
.guest-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.guest-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.guest-fields > label, .guest-form-grid > label { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.guest-fields input, .guest-fields select, .guest-fields textarea { display: block; width: 100%; min-width: 0; font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: white; padding: 11px 12px; line-height: 1.6; }
.guest-fields textarea { resize: vertical; min-height: 160px; max-height: 40vh; }
.guest-fields input:focus, .guest-fields select:focus, .guest-fields textarea:focus { outline: 2px solid #98b7ef; outline-offset: 2px; border-color: var(--action); }
.guest-fields input:disabled, .guest-fields textarea:disabled { background: #f7f9fb; }
.guest-record-actions { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.guest-danger { color: #a53030; }
.guest-source { color: #7a8494; font-size: 12px; line-height: 1.8; }
.guest-audit { margin-top: 20px; border-top: 1px solid #e9edf2; padding-top: 16px; }
.guest-audit summary { cursor: pointer; }
.guest-audit ol { padding-left: 18px; max-height: 260px; overflow-y: auto; }
.guest-audit li { padding: 12px 0; border-bottom: 1px solid #edf0f4; }
.guest-audit small { display: block; color: #758092; }
.guest-audit p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; margin: 5px 0; }
.guest-upload-note, .guest-import-summary { padding: 16px; background: #f6f8fb; border-radius: 10px; margin-bottom: 20px; }
.guest-upload-note p, .guest-import-summary p { line-height: 1.7; color: #667287; font-size: 13px; }
.guest-import-dialog { width: min(1080px, calc(100vw - 32px)); max-width: 1080px; }
.guest-import-scroll { max-height: 48vh; overflow: auto; }
.guest-import-scroll table { min-width: 680px; }
.guest-import-scroll td { white-space: normal; vertical-align: top; max-width: 320px; }
.guest-import-scroll select { display: block; min-width: 115px; margin-top: 8px; }
.guest-import-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
@media(max-width: 640px) { .guest-form-grid { grid-template-columns: 1fr; } .guest-panel .staff-controls { width: 100%; } }
