:root {
  --blue: #004280;
  --blue-hover: #0a5398;
  --blue-tint: #e8f0f8;
  --ink: #17232f;
  --muted: #5a6a7a;
  --line: #d8e0e8;
  --paper: #f3f5f8;
  --white: #fff;
  --danger: #b3261e;
  --danger-tint: #fbeceb;
  --ok: #1c6f46;
  --ok-tint: #e6f4ec;
  --warn: #7a4f00;
  --warn-tint: #fdf1d6;
  --font: "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.6 var(--font);
  color: var(--ink);
  background: var(--paper);
}
a { color: var(--blue); text-underline-offset: 2px; }
a:hover { color: var(--blue-hover); }
:focus-visible { outline: 3px solid #6fa8e0; outline-offset: 2px; }
code, .mono, pre { font-family: var(--mono); }
code { font-size: .9em; background: var(--blue-tint); padding: 1px 5px; border-radius: 3px; }
small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.block { display: block; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 40px; padding: 0 18px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: 4px;
}
.btn.block { display: flex; width: 100%; }
.btn.primary { background: var(--blue); color: var(--white); }
.btn.primary:hover { background: var(--blue-hover); color: var(--white); }
.btn.secondary { background: var(--white); color: var(--blue); border-color: var(--blue); }
.btn.secondary:hover { background: var(--blue-tint); }
.btn.danger { background: var(--danger); color: var(--white); }
.btn.danger:hover { background: #8f1d17; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.danger-text { color: var(--danger); }

.form { display: grid; gap: 16px; }
.form.wide { max-width: 640px; margin-top: 20px; }
.form label { display: grid; gap: 6px; font-weight: 600; }
.form label small { font-weight: 400; }
.form label.check { display: flex; align-items: center; gap: 10px; font-weight: 400; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: 9px 12px; background: var(--white);
  border: 1px solid #aebbc8; border-radius: 4px;
}
textarea { resize: vertical; font-family: var(--mono); font-size: 13.5px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); }
form.inline { display: inline; }
.form .btn { justify-self: start; }
.form .btn.block { justify-self: stretch; }

/* ---------- messages ---------- */
.flash, .notice {
  margin: 0 0 20px; padding: 12px 16px; border-radius: 4px; border-left: 4px solid;
}
.flash.ok { background: var(--ok-tint); border-color: var(--ok); color: #104a2e; }
.flash.error { background: var(--danger-tint); border-color: var(--danger); color: #7d1913; }
.notice { background: var(--warn-tint); border-color: #d99a00; color: var(--warn); }
.notice a { color: inherit; font-weight: 600; margin-left: 6px; }
.hint { color: var(--muted); font-size: 13.5px; max-width: 640px; }
.empty { color: var(--muted); margin: 0; padding: 20px 0; }

/* ---------- plain pages (login, errors) ---------- */
.plain-body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.door { width: 100%; max-width: 440px; background: var(--white); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.door-logo { display: block; width: 100%; height: auto; }
.door-body { padding: 28px 32px 32px; display: grid; gap: 18px; }
.door-title { margin: 0; font-size: 22px; line-height: 1.3; }
.lead { margin: 0; font-size: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.or { display: flex; align-items: center; gap: 12px; margin: 4px 0; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.foot { margin: 18px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- admin shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--blue); color: var(--white);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: block; }
.brand img { display: block; width: 100%; height: auto; }
.nav { display: flex; flex-direction: column; padding: 14px 0; flex: 1; }
.nav a {
  color: #d5e3f2; text-decoration: none; padding: 10px 24px;
  border-left: 4px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.08); color: var(--white); }
.nav a[aria-current="page"] { color: var(--white); font-weight: 600; background: rgba(255,255,255,.12); border-left-color: var(--white); }
.side :focus-visible { outline-color: #bcd8f5; }
.who { padding: 16px 24px 20px; border-top: 1px solid rgba(255,255,255,.18); display: grid; gap: 4px; font-size: 14px; }
.who-name { overflow-wrap: anywhere; }
.who .linkbtn { color: #d5e3f2; justify-self: start; }
.who .linkbtn:hover { color: var(--white); }

.main { padding: 32px 40px 64px; min-width: 0; max-width: 1180px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 26px; line-height: 1.25; }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 22px 24px; margin-bottom: 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel.secret { border-color: #d99a00; background: #fffaf0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--white); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 24px; }
.stats div { padding: 20px 24px; border-left: 1px solid var(--line); }
.stats div:first-child { border-left: 0; }
.stats b { display: block; font-size: 34px; line-height: 1.1; font-weight: 600; color: var(--blue); font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 14px; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td small.mono { font-size: 12px; }

.tag { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12.5px; font-weight: 600; background: var(--blue-tint); color: var(--blue); }
.tag.ok, .tag.ev-login { background: var(--ok-tint); color: var(--ok); }
.tag.off { background: #e9edf1; color: var(--muted); }
.tag.warn { background: var(--warn-tint); color: var(--warn); }
.tag.ev-denied { background: var(--danger-tint); color: var(--danger); }

.filters, .search { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 14px; }
.filters label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; min-width: 200px; }
.search input { min-width: 240px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; color: var(--muted); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

pre.code { background: #0f2236; color: #e6eef7; padding: 16px 18px; border-radius: 4px; overflow-x: auto; font-size: 13px; line-height: 1.55; margin: 10px 0 0; }
.secret pre.code { font-size: 15px; user-select: all; }
.prose p, .prose li { max-width: 72ch; }
.prose ol, .prose ul { padding-left: 22px; }

details.danger { border-top: 1px solid var(--line); padding: 14px 0; }
details.danger:first-of-type { border-top: 0; padding-top: 0; }
details.danger summary { cursor: pointer; font-weight: 600; }
details.danger p { color: var(--muted); max-width: 640px; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; min-width: 0; }
  .brand img { max-width: 320px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 0; }
  .nav a { white-space: nowrap; padding: 12px 16px; border-left: 0; border-bottom: 4px solid transparent; }
  .nav a[aria-current="page"] { border-left: 0; border-bottom-color: var(--white); }
  .who { grid-template-columns: 1fr auto; align-items: center; padding: 10px 16px; }
  .main { padding: 20px 16px 48px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(3) { border-left: 0; }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 10px; }
  .door-body { padding: 24px 20px 28px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- user detail ---------- */
.userhead { display: flex; gap: 20px; align-items: center; }
.userhead h2 { margin: 0; font-size: 22px; }
.userhead p { margin: 2px 0 0; }
.avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex: none; background: var(--blue-tint); }
.avatar.blank { display: grid; place-items: center; color: var(--blue); font-size: 30px; font-weight: 600; overflow: hidden; white-space: nowrap; }
.kv-dense { gap: 6px 24px; font-size: 14px; }
.kv-dense dt { font-size: 13px; }
.taglist { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
details summary { cursor: pointer; font-weight: 600; }

/* ---------- language switcher ---------- */
.langs { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.langs a { text-decoration: none; color: var(--muted); }
.langs a:hover { text-decoration: underline; }
.langs a[aria-current="true"] { color: var(--ink); font-weight: 600; }
.who .langs { margin-top: 8px; }
.who .langs a { color: #bcd0e6; }
.who .langs a:hover { color: var(--white); }
.who .langs a[aria-current="true"] { color: var(--white); }
.foot { margin-top: 10px; }
.plain-body .langs { margin-top: 18px; }
.plain-body .foot { margin-top: 8px; }

/* ---------- graph explorer / org ---------- */
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13.5px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.presets .btn { justify-self: auto; }
.photo { max-width: 160px; border-radius: 50%; display: block; }
.panel h3 { margin: 18px 0 4px; font-size: 15px; }
.panel h3:first-of-type { margin-top: 6px; }
.panel-head .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0; }
ul.notes { margin: 6px 0; padding-left: 20px; }
select { min-height: 40px; }

/* ---------- developer guide (public) ---------- */
.docs-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--blue); color: var(--white); padding: 0 24px 0 0;
}
.docs-brand img { display: block; height: 56px; width: auto; }
.docs-top-right { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 8px 0; }
.docs-top-right > a { color: var(--white); font-size: 14px; }
.docs-top .langs a { color: #bcd0e6; }
.docs-top .langs a:hover { color: var(--white); }
.docs-top .langs a[aria-current="true"] { color: var(--white); }
.docs-main { max-width: 1040px; margin: 0 auto; padding: 32px 24px 48px; }
.docs-hero h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.25; }
.docs-hero p { margin: 0 0 20px; max-width: 80ch; color: var(--muted); font-size: 16px; }
.docs-foot { text-align: center; padding-bottom: 24px; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.toc a {
  padding: 4px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--white);
  text-decoration: none; font-size: 13.5px;
}
.toc a:hover { border-color: var(--blue); background: var(--blue-tint); }
.docs-main section { scroll-margin-top: 16px; }
.docs-main .prose p, .docs-main .prose li { max-width: 86ch; }
ol.steps li, ol.flow li { margin-bottom: 8px; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; }
details.sample { border-top: 1px solid var(--line); padding: 12px 0; }
details.sample:first-of-type { margin-top: 18px; }
details.sample summary { font-size: 16px; }
details.sample summary .mono { font-weight: 400; font-size: 13px; margin-left: 8px; }
.sample-actions { margin: 10px 0 0; }
.codewrap { position: relative; }
.copybtn {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  font: 600 12px/1 var(--font); padding: 6px 10px; cursor: pointer;
  color: #e6eef7; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 4px;
}
.copybtn:hover { background: rgba(255,255,255,.22); }
.docs-main pre.code { max-height: 560px; }
.docs-main dl.kv dd small { display: inline; margin-left: 8px; }
.docs-main td.mono { font-size: 13px; }
@media (max-width: 860px) {
  .docs-main { padding: 20px 16px 40px; }
  .docs-brand img { height: 44px; }
  .docs-top { padding-right: 16px; }
}
.btn-preview { max-width: 380px; padding: 24px; margin: 8px 0 16px; background: var(--paper); border: 1px dashed #aebbc8; border-radius: 6px; }
.btn-preview .form { gap: 12px; }
.btn-preview .form label { font-size: 14px; }
ol.chain { margin: 6px 0; padding-left: 22px; }
ol.chain li { margin-bottom: 4px; }
small.inline { display: inline; margin-left: 6px; }

/* ---------- per-service data permissions ---------- */
.fieldperm { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.fieldperm fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 10px 16px 14px; margin: 0; display: grid; gap: 6px; }
.fieldperm legend { font-weight: 600; padding: 0 6px; }
.fieldperm label.check { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.fieldperm label.check input { flex: none; align-self: center; }
.fieldperm label.check .muted { font-size: 13px; }
.fieldperm .hint { margin: 4px 0 0; font-size: 13px; }
.fieldperm > .btn { grid-column: 1 / -1; justify-self: start; }
details.preview { margin-top: 18px; }

/* ---------- developer guide: quick start ---------- */
.appurl-field { display: grid; gap: 6px; max-width: 560px; margin: 4px 0 24px; font-weight: 600; }
.appurl-field input { font-family: var(--mono); font-size: 15px; }
.appurl-field input.bad { border-color: var(--danger); background: var(--danger-tint); }
.appurl-field small { font-weight: 400; }
.step { border-left: 4px solid var(--blue); }
.stepno {
  display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 10px;
  border-radius: 50%; background: var(--blue); color: var(--white); font-size: 15px; vertical-align: 1px;
}
.step .panel-head h2 { font-size: 19px; }
.tablist { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 2px solid var(--line); margin: 6px 0 16px; }
.tablist button {
  font: 600 14px/1 var(--font); padding: 10px 14px; cursor: pointer; color: var(--muted);
  background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tablist button:hover { color: var(--blue); }
.tablist button[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }
.langtabs:not(.tabs-ready) .tablist { display: none; }
.langtabs.tabs-ready .tabpanel-title { display: none; }
.tabpanel + .tabpanel { margin-top: 24px; }
.langtabs.tabs-ready .tabpanel + .tabpanel { margin-top: 0; }
.kitgrid { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 20px; align-items: start; }
.kitgrid h4 { margin: 0 0 4px; font-size: 14px; }
pre.tree { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; margin: 10px 0 0; font-size: 13px; line-height: 1.6; overflow-x: auto; }
.kitgrid .hint { margin: 8px 0 0; }
details.code-details { margin-top: 14px; }
ol.checks li { margin-bottom: 6px; }
table.want > tbody > tr > td:first-child { font-weight: 600; width: 32%; }
table.mini { width: auto; font-size: 13px; margin-bottom: 4px; }
table.mini td { padding: 3px 14px 3px 0; border: 0; }
.adv-title { margin: 40px 0 4px; font-size: 20px; }
.adv-lead { margin: 0 0 14px; color: var(--muted); }
details.adv { padding: 0; margin-bottom: 10px; }
details.adv > summary { padding: 14px 24px; list-style-position: inside; }
details.adv > summary h3 { display: inline; font-size: 16px; margin: 0; }
details.adv[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
details.adv > :not(summary) { margin-left: 24px; margin-right: 24px; }
details.adv > :last-child { margin-bottom: 20px; }
@media (max-width: 860px) {
  .kitgrid { grid-template-columns: 1fr; }
  table.want > tbody > tr > td:first-child { width: auto; }
}

/* ---------- service owners / guided setup ---------- */
.who-role { color: #bcd0e6; font-size: 12px; }
.setup-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-left: 4px solid var(--blue); }
.setup-cta h2 { margin: 0 0 4px; font-size: 17px; }
.setup-cta .hint { margin: 0; }
fieldset.choices { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
fieldset.choices legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
label.choice { display: flex; align-items: center; gap: 10px; font-weight: 400; }
label.choice input { width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
label.choice small { display: inline; margin-left: 4px; }
.crumbs { margin: -8px 0 8px; }
.lead-text { margin: 0 0 20px; color: var(--muted); max-width: 80ch; }
.btn.big { min-height: 48px; padding: 0 24px; font-size: 16px; }
.kitform { margin: 0 0 16px; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- overview dashboard ---------- */
.dash { --series-login: #2a78d6; --series-deny: #e34948; --ink-2: #52606d; --hair: #e3e8ee; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: -6px 0 20px; }
.dash-hello { margin: 0; font-size: 20px; font-weight: 600; }
.dash-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; background: #e6ebf1; border-radius: 8px; padding: 3px; gap: 2px; }
.seg a { padding: 6px 14px; border-radius: 6px; text-decoration: none; color: var(--ink-2); font-size: 13.5px; font-weight: 600; }
.seg a:hover { color: var(--blue); }
.seg a[aria-current="true"] { background: var(--white); color: var(--blue); box-shadow: 0 1px 2px rgba(16, 40, 70, .12); }

.kpis { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.kpi { position: relative; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px 16px; min-height: 148px; display: flex; flex-direction: column; }
.kpi h2 { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.kpi-value { margin: 6px 0 0; font-size: 32px; line-height: 1.1; font-weight: 600; color: var(--ink); }
.kpi-hero { background: linear-gradient(135deg, #004280 0%, #0a5398 60%, #1666b3 100%); border-color: transparent; color: var(--white); }
.kpi-hero h2, .kpi-hero .muted { color: #c9dcf0; }
.kpi-hero .kpi-value { color: var(--white); font-size: 48px; }
.kpi-delta { margin: 6px 0 0; font-size: 13px; }
.kpi-foot { margin: auto 0 0; padding-top: 10px; color: var(--muted); font-size: 13px; }
.kpi-link { margin: 4px 0 0; font-size: 13px; }
.kpi-link a { text-decoration: none; font-weight: 600; }
.delta { font-weight: 600; }
.delta.good { color: var(--ok); }
.delta.bad { color: var(--danger); }
.delta.flat { color: var(--muted); }
.kpi-hero .delta.flat { color: #c9dcf0; }
.kpi-hero .delta.good { color: #9ff0c4; }
.kpi-hero .delta.bad { color: #ffc2c0; }
.spark { display: block; width: 100%; height: 34px; margin-top: auto; padding-top: 10px; overflow: visible; }
.spark polyline { fill: none; stroke: #8fbbe9; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.kpi-hero .spark polyline { stroke: rgba(255, 255, 255, .75); }
.kpi-hero .spark circle { fill: var(--white); stroke: #0a5398; stroke-width: 2; }
.spark-deny polyline { stroke: #f0a3a2; }

.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: stretch; margin-bottom: 20px; }
.dash-grid.even { grid-template-columns: 1fr 1fr; }
.dash-grid > .panel { margin-bottom: 0; }
.dash .panel { border-radius: 10px; }
.legend { display: flex; gap: 16px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.key-login { background: var(--series-login); }
.key-deny { background: var(--series-deny); }

.colchart { width: 100%; height: auto; display: block; overflow: visible; }
.colchart .grid { stroke: var(--hair); stroke-width: 1; }
.colchart .axis { stroke: #c9d2dc; stroke-width: 1; }
.colchart .tick { fill: var(--muted); font: 11px var(--font); }
.heat .tick { fill: var(--muted); font: 13px var(--font); }
.colchart .hit { fill: transparent; }
.colchart .seg-login { fill: var(--series-login); }
.colchart .seg-deny { fill: var(--series-deny); }
.colchart .bar:hover .hit, .colchart .bar:focus .hit { fill: rgba(42, 120, 214, .07); }
.colchart .bar:focus { outline: none; }
.tableview { margin-top: 10px; font-size: 13.5px; }
.tableview summary { font-weight: 400; color: var(--muted); font-size: 13px; }

.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name val" "bar bar"; gap: 4px 12px; }
.hb-name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; color: var(--ink); font-size: 14px; }
.hb-name:hover { color: var(--blue); text-decoration: underline; }
.hb-val { grid-area: val; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.hb-track { grid-area: bar; width: 100%; height: 10px; display: block; }
.hb-bg { fill: #eef2f6; }
.hb-bar { fill: var(--series-login); }

.heat { width: 100%; height: auto; display: block; }
.heat .cell:focus { outline: none; }
.heat .cell:hover rect:first-child, .heat .cell:focus rect:first-child { stroke: var(--ink); stroke-width: 1.5; }
.heat .now { fill: var(--ink); }
.heat-legend { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.heat-legend svg { width: 84px; height: 12px; }

.status { list-style: none; margin: 0; padding: 0; }
.status li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.status li:first-child { border-top: 0; padding-top: 2px; }
.status b { display: block; font-size: 14px; font-weight: 600; }
.status small { font-size: 12.5px; }
.status a { text-decoration: none; color: var(--muted); padding: 4px 6px; }
.status a:hover { color: var(--blue); }
.st-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.st-ok .st-icon { background: var(--ok-tint); color: var(--ok); }
.st-warn .st-icon { background: var(--warn-tint); color: var(--warn); }
.st-bad .st-icon { background: var(--danger-tint); color: var(--danger); }
.st-off .st-icon { background: #edf0f3; color: var(--muted); }

.tip {
  position: fixed; z-index: 50; pointer-events: none; white-space: pre-line;
  background: #0f2236; color: #e6eef7; font-size: 12.5px; line-height: 1.5;
  padding: 7px 10px; border-radius: 6px; box-shadow: 0 6px 18px rgba(10, 30, 60, .22); max-width: 260px;
}
.tip::first-line { color: #9fb6cc; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .dash-grid, .dash-grid.even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi-hero .kpi-value { font-size: 40px; }
}
.files-title { margin: 22px 0 6px; font-size: 14px; }
details.code-details.file { margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
details.code-details.file summary { font-weight: 600; font-size: 13.5px; }
details.code-details.file[open] summary { margin-bottom: 4px; }

/* ---------- developer guide: basic / advanced switch ---------- */
.devswitch { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 640px; margin: 0 0 22px; }
.devswitch a { display: grid; gap: 2px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); text-decoration: none; color: var(--ink); }
.devswitch a:hover { border-color: var(--blue); }
.devswitch a[aria-current="page"] { border: 2px solid var(--blue); padding: 11px 15px; background: var(--blue-tint); }
.devswitch b { font-size: 15px; color: var(--blue); }
.devswitch small { font-size: 12.5px; }
table.libs td.url { font-size: 12.5px; word-break: break-all; min-width: 220px; }
table.libs td, table.resp td { vertical-align: middle; }
table.resp td:first-child { white-space: nowrap; }
.legend-list { list-style: none; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.checklist { list-style: none; padding: 0; }
.checklist li { position: relative; padding-left: 28px; margin-bottom: 8px; }
.checklist li::before { content: "☐"; position: absolute; left: 4px; top: -1px; color: var(--blue); font-size: 16px; }
@media (max-width: 560px) { .devswitch { grid-template-columns: 1fr; } table.resp td:first-child { white-space: normal; } }
.tag { white-space: nowrap; }
table.libs td:first-child { white-space: nowrap; }

/* ---------- sign-in steps (advanced guide) ---------- */
ol.flowsteps { list-style: none; counter-reset: fs; margin: 8px 0 12px; padding: 0; }
ol.flowsteps li { counter-increment: fs; position: relative; padding: 0 0 18px 52px; max-width: none; }
ol.flowsteps li::before {
  content: counter(fs); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--blue); color: var(--white); font-weight: 600;
}
ol.flowsteps li:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 38px; bottom: 4px; width: 2px; background: var(--line); }
.fs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 34px; }
.fs-head b { font-size: 15px; margin-right: 4px; }
ol.flowsteps p { margin: 2px 0 0; color: #52606d; font-size: 14px; }
.who { font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 10px; white-space: nowrap; }
.w-browser { background: #e8f0f8; color: #004280; }
.w-backend { background: #fdf1d6; color: #7a4f00; }
.w-sso { background: #e6f4ec; color: #1c6f46; }
.w-ms { background: #edf0f3; color: #3c4a57; }

/* ---------- copy buttons ---------- */
.copymini {
  margin-left: 8px; vertical-align: 1px; padding: 1px 8px; font: 600 11.5px/1.5 var(--font);
  color: var(--blue); background: var(--white); border: 1px solid #b9cbe0; border-radius: 4px; cursor: pointer;
}
.copymini:hover { background: var(--blue-tint); }
.copymini.done, .copybtn.done { color: var(--ok); border-color: #9fd3b6; }
.copybtn.done { color: #9ff0c4; }
code.copyable .copymini { font-family: var(--font); }
.inline-select { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; margin: 4px 0 6px; }
.inline-select select { width: auto; min-width: 260px; }
fieldset.fieldgroup { border: 1px solid var(--line); border-radius: 6px; padding: 10px 16px 14px; margin: 0; display: grid; gap: 8px; }
fieldset.fieldgroup legend { font-weight: 600; padding: 0 4px; }
fieldset.fieldgroup label.check { font-weight: 400; }
.btn.busy { opacity: .7; cursor: progress; }
#az-test .flash, #dir-test .flash { margin-top: 12px; }

/* ---------- developer guide: product switch + People & Groups API ---------- */
.productswitch { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 14px; border-bottom: 2px solid var(--line); }
.productswitch a { display: grid; gap: 1px; padding: 10px 18px 10px 0; margin-right: 22px; margin-bottom: -2px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; }
.productswitch a b { font-size: 16px; color: var(--ink); }
.productswitch a small { font-size: 12px; }
.productswitch a:hover b { color: var(--blue); }
.productswitch a[aria-current="page"] { border-bottom-color: var(--blue); }
.productswitch a[aria-current="page"] b { color: var(--blue); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 700; color: var(--blue); margin: 0 0 4px; }
.pp-facts { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pp-facts li { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.pp-facts b { color: var(--blue); }
.pp-facts span { font-size: 14px; color: var(--muted); }
.pp-toc ol { margin: 6px 0 0; padding-left: 22px; columns: 2 220px; column-gap: 28px; }
.pp-toc ol ol { columns: 1; margin: 2px 0 4px; }
.pp-toc li { break-inside: avoid; margin: 2px 0; }
.pp-ep { border-left: 4px solid var(--blue); }
.pp-ep-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; }
.pp-method { font: 700 12px/1 var(--mono); color: #fff; background: var(--ok); border-radius: 4px; padding: 5px 7px; }
.pp-path { font-size: 15px; font-weight: 600; word-break: break-all; }
.pp-scope { font-family: var(--mono); }
.pp-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 860px) { .pp-cols { grid-template-columns: minmax(0, 1fr); } }
.pp-calls th { width: 1%; font-weight: 600; }
.pp-calls td { font-size: 13px; word-break: break-word; }
.pp-pointer { border-left: 4px solid var(--blue); }
dl.faq dt { font-weight: 700; margin-top: 14px; }
dl.faq dd { margin: 4px 0 0; }
.pp-ep pre.code { white-space: pre-wrap; overflow-wrap: anywhere; }
.pp-ep pre.code[data-copy] { padding-right: 76px; }
fieldset.fieldgroup.cols { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
fieldset.fieldgroup.cols legend { grid-column: 1 / -1; }
/* ---------- API playground ---------- */
.pg-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pg-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; }
.pg-params label small { font-weight: 400; color: var(--muted); }
.pg-req, .pg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.pg-body mark { background: #ffe58a; color: #3d2e00; border-radius: 3px; padding: 0 2px; }
.pg-photo { border-radius: 50%; border: 1px solid var(--line); }
.form label.check > input { flex: none; width: auto; margin: 0; }
.form label.check { align-items: flex-start; }
.form label.check > input { margin-top: 4px; }
