:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #182435;
  background: #f4f6f9;
  --ink: #182435;
  --muted: #536277;
  --border: #dce3ec;
  --accent: #125b63;
  --accent-strong: #0b4b53;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 22px;
  padding: 16px max(20px, calc((100% - 1180px) / 2));
  color: #eff7f8; background: #132738;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; font-weight: 720; text-decoration: none; white-space: nowrap; }
.mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: #113039; background: #9ae3df; }
.toolbar nav, .account { display: flex; align-items: center; gap: 10px; }
.toolbar nav { flex-wrap: wrap; }
.toolbar nav a { padding: 8px 10px; color: #d0dce5; text-decoration: none; white-space: nowrap; border-radius: 7px; }
.toolbar nav a[aria-current] { background: #284752; color: #fff; }
.account { margin-left: auto; font-size: 13px; }
.toolbar .quiet { color: #e6f3f3; }
main { width: min(1180px, calc(100% - 40px)); margin: 35px auto 64px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(26px, 4vw, 40px); letter-spacing: -.025em; }
h2 { font-size: 19px; letter-spacing: -.015em; margin-bottom: 13px; }
p { line-height: 1.6; }
.muted { color: var(--muted); font-size: 14px; }
.note { margin: 13px 0; }
.page-heading, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.page-heading { margin: 0 0 22px; }
.page-heading p { margin-top: 6px; }
.card { min-width: 0; padding: 22px; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
#channelsPage > .card, #insightsPage > .card, #reportResults > .card, .metric-grid, .channel-top { margin-bottom: 15px; }
.account-card { max-width: 440px; margin: 8vh auto 0; padding: clamp(22px, 5vw, 36px); }
.account-card h1 { font-size: 27px; margin-bottom: 7px; }
.account-card form { display: grid; gap: 14px; margin-top: 25px; }
.account-card .primary { margin-top: 4px; }
.channel-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(230px, 1fr); gap: 15px; align-items: start; }
.channel-top > :only-child, .channel-top:has(#inviteCard[hidden]) > :first-child { grid-column: 1 / -1; }
#inviteCard p { margin-bottom: 16px; }
.fields, .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.registration-field { grid-column: 1 / -1; }
.filters { grid-template-columns: minmax(138px, 1fr) minmax(138px, 1fr) minmax(140px, 2fr) auto; align-items: end; }
label { min-width: 0; display: grid; gap: 6px; color: #334458; font-size: 13px; font-weight: 630; }
input, select, button { font: inherit; }
input, select {
  width: 100%; min-width: 0; min-height: 41px; padding: 7px 10px; border-radius: 7px;
  border: 1px solid #c8d2df; color: var(--ink); background: #fff; font-size: 14px;
}
button, .quiet {
  display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 7px 12px;
  background: #fff; border: 1px solid #cbd7e4; border-radius: 7px; color: var(--accent);
  cursor: pointer; font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap;
}
button:hover, .quiet:hover { background: #eff7f7; }
button:disabled { cursor: wait; opacity: .65; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover { background: var(--accent-strong); }
.quiet { background: transparent; border-color: transparent; }
.toolbar .quiet:hover { background: #284752; }
:focus-visible { outline: 2px solid #158380; outline-offset: 3px; }
.status { color: var(--muted); font-size: 13px; margin-top: 10px; }
.status:empty { display: none; }
.top-status { margin: 0 0 12px; }
.status[data-error] { color: #a42620; }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin-top: 14px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e5ebf1; text-align: left; }
th { color: #425367; background: #f7f9fc; white-space: nowrap; font-size: 13px; }
td:first-child { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; }
.actions a { margin-left: 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.metric { display: grid; gap: 8px; border-top: 3px solid #53aaa7; }
.metric span { color: var(--muted); font-size: 14px; }
.metric dl { display: flex; flex-wrap: wrap; gap: 6px 19px; margin: 0; }
.metric dt { color: var(--muted); font-size: 12px; }
.metric dd { margin: 0; font-size: clamp(19px, 4vw, 34px); font-weight: 710; font-variant-numeric: tabular-nums; }
.uv-coverage { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.report-table .uv-coverage { display: block; margin-top: 3px; }
.report-table :is(th,td):not(:first-child) { white-space: nowrap; }
.report-table td { font-variant-numeric: tabular-nums; }
.report-table td:first-child { min-width: 7em; }
.link-detail { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.inline-label { display: flex; align-items: center; }
.inline-label select { width: auto; }
#trend { display: block; width: 100%; height: 205px; margin-top: 10px; }
.daily { color: var(--muted); font-size: 13px; margin-top: 12px; }
.daily summary { cursor: pointer; padding: 5px 0; }
@media (max-width: 720px) {
  main { width: calc(100% - 28px); margin-top: 26px; }
  .toolbar { padding: 12px 14px; gap: 10px; }
  .toolbar nav { order: 3; width: 100%; }
  .card { padding: 15px; }
  .channel-top { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { gap: 7px; }
  .metric { padding: 11px 8px; }
  .metric span { font-size: 12px; }
}
@media (max-width: 420px) {
  .fields { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
}

#loadMonitorContent > .card { margin-bottom: 15px; }
#recordsPage > .card { margin-bottom: 15px; }
.records-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 13px; align-items: end; }
.records-filters > button { justify-self: start; }
.records-export, .records-paging { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.records-paging { justify-content: center; margin-top: 18px; }
.records-table { min-width: 720px; }
.records-table :is(th, td) { min-width: 105px; max-width: 280px; overflow-wrap: anywhere; vertical-align: top; }
.records-table th { white-space: normal; }
.records-table td button { white-space: nowrap; }
.records-table th small { display: block; margin-top: 3px; font-weight: 400; color: var(--muted); }
.records-table .record-null { color: var(--muted); font-style: italic; }
#recordsDetail { margin-top: 20px; }
#recordsDetail summary { padding: 8px 0; color: var(--accent); }
#recordsRaw { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); font-size: 13px; line-height: 1.65; }
.load-alert { border-color: #ecc8c2; background: #fff2ef; color: #8f271f; }
.load-alert p { margin-top: 4px; }
.load-period-heading { margin-bottom: 16px; align-items: flex-start; flex-wrap: wrap; }
.load-period-heading h2 { margin-bottom: 4px; }
.load-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.load-metrics div { border: 1px solid var(--border); border-radius: 9px; min-width: 0; padding: 12px; background: #f7f9fc; }
.load-metrics dt { color: var(--muted); font-size: 13px; }
.load-metrics dd { margin: 5px 0 0; font-size: clamp(23px, 3vw, 34px); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.load-metrics span { display: block; font-size: 12px; margin-top: 4px; }
.load-metrics .load-problems { background: #fff4f2; border-color: #ecd1cc; color: #a42620; }
.load-chart-heading { align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 9px; }
.load-chart-heading h3 { margin: 0; font-size: 15px; }
.load-chart { display: grid; gap: 6px; }
.load-chart-row { display: grid; grid-template-columns: 122px minmax(0, 1fr) minmax(34px, auto); gap: 9px; align-items: center; font-variant-numeric: tabular-nums; }
.load-chart-row time { font-size: 12px; color: var(--muted); }
.load-chart-row output { text-align: right; }
.load-chart-bar { display: flex; height: 9px; border-radius: 3px; background: #edf1f5; overflow: hidden; }
.load-good { background: #3e928a; }
.load-failure { background: #c95145; }
.load-unknown { background: #a8b5c7; }
.load-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 9px; }
.load-legend span { display: inline-flex; align-items: center; gap: 5px; }
.load-legend i { width: 8px; height: 8px; border-radius: 2px; }
.load-notes { margin-top: 11px; }
.load-scope .table-scroll, .load-incidents .table-scroll { margin-top: 9px; }
.load-incidents button { min-height: 34px; }
@media (max-width: 640px) {
  .toolbar nav { flex-wrap: wrap; gap: 4px; }
  .load-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .load-chart-row { grid-template-columns: 108px minmax(0, 1fr) minmax(28px, auto); gap: 5px; }
  #loadMonitorContent .report-table :is(th, td) { padding: 9px 6px; white-space: normal; min-width: 0; }
  .load-incidents button { padding: 5px 7px; font-size: 13px; }
}

/* Dashboard selection and conversation reporting. */
.filter-label { color:#334458; font-size:13px; font-weight:630; }
.link-filter { min-width:0; display:grid; gap:6px; }
.link-picker { position:relative; min-width:0; }
.link-picker > summary { min-height:41px; padding:9px 12px; border:1px solid #c8d2df; border-radius:7px; background:#fff; cursor:pointer; font-size:14px; overflow-wrap:anywhere; }
.link-picker-panel { position:absolute; z-index:20; top:calc(100% + 7px); left:0; width:max(100%,320px); max-width:min(560px,80vw); padding:14px; background:#fff; border:1px solid var(--border); border-radius:10px; box-shadow:0 12px 35px #18243522; }
.check-option { display:flex; align-items:flex-start; gap:9px; padding:9px 0; font-size:13px; line-height:1.55; cursor:pointer; }
.check-option input { width:17px; min-width:17px; min-height:17px; height:17px; margin-top:2px; accent-color:var(--accent); }
.link-picker-actions { display:flex; gap:8px; margin:9px 0; }
.link-picker-options { max-height:260px; overflow-y:auto; overscroll-behavior:contain; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.report-table tfoot { background:#eef7f7; color:var(--accent); font-weight:700; border-top:2px solid #dcebea; }
.chat-metric-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:0 0 20px; }
.chat-metric-grid article { min-width:0; padding:14px; border:1px solid #e5ebf1; border-radius:8px; background:#f7f9fc; display:grid; gap:8px; }
.chat-metric-grid span { font-size:13px; color:var(--muted); }
.chat-metric-grid strong { font-size:24px; font-variant-numeric:tabular-nums; }
.chat-metric-grid .round-distribution { font-size:13px; line-height:1.7; }
.metric-link { min-height:0; padding:0; border:0; border-radius:0; font-weight:650; text-decoration:underline; text-underline-offset:3px; }
.metric-link:disabled { color:inherit; text-decoration:none; opacity:1; cursor:default; }
.conversation-dialog { width:min(1120px,calc(100% - 28px)); max-height:calc(100dvh - 32px); box-sizing:border-box; overflow-y:auto; padding:24px; border:1px solid var(--border); border-radius:14px; color:var(--ink); background:#f4f6f9; }
.conversation-dialog::backdrop { background:#13273899; }
.conversation-filters { display:grid; grid-template-columns:1fr 1fr minmax(180px,2fr) auto; gap:12px; align-items:end; margin:20px 0 12px; }
.conversation-thread { padding:18px; border:1px solid var(--border); border-radius:12px; background:#fff; margin-top:20px; }
.conversation-turn { padding:16px 0; border-bottom:1px solid var(--border); }
.conversation-turn:last-child { border-bottom:0; }
.conversation-question { white-space:pre-wrap; overflow-wrap:anywhere; padding:14px; border-radius:9px; background:#eef3f8; margin:9px 0; }
.conversation-guide { border-left:3px solid #53aaa7; padding:8px 12px; margin:8px 0; background:#f1f8f8; font-size:14px; line-height:1.7; }
.conversation-dialog h3 { overflow-wrap:anywhere; }
@media(max-width:720px) {
 .link-picker-panel { width:min(380px,calc(100vw - 58px)); max-width:calc(100vw - 58px); left:0; right:auto; }
 .chat-metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .chat-metric-grid strong { font-size:20px; }
 .conversation-dialog { padding:16px; }
 .conversation-filters { grid-template-columns:1fr 1fr; }
 .conversation-filters label:last-of-type { grid-column:1/-1; }
}
