/* Tokens & Base */
:root {
  color-scheme: light;
  --paper: #f8fafc;
  --white: #fff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, .08);
  --accent: #0f172a;
  --accent-hover: #1e293b;
  --accent-soft: #f1f5f9;
  --hero: #fff;
  --green: #176a55;
  --green-soft: #eaf8f3;
  --body: "Geist", "Inter", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --ease-spring: cubic-bezier(.16, 1, .3, 1);
}
* { box-sizing: border-box; }
html { min-width: 300px; background: var(--paper); }
body { margin: 0; color: var(--ink); font: 15px/1.55 var(--body); }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.22; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: progress; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.wrap { width: min(1160px, calc(100% - 80px)); margin-inline: auto; }
/* Header & Shared Controls */
.header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; min-height: 68px; gap: 38px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 760; letter-spacing: -.064em; white-space: nowrap; }
.mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--white);
  font-weight: 700;
  font-size: 23px;
  line-height: 1;
  letter-spacing: 0;
}
.nav { display: flex; align-items: stretch; align-self: stretch; gap: 27px; }
.nav a { display: inline-flex; align-items: center; position: relative; color: var(--muted); font-weight: 600; white-space: nowrap; transition: color .15s ease; }
.nav a[aria-current] { color: var(--accent); }
.nav a[aria-current]::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; border-radius: 5px; background: var(--accent); }
.header-source { margin-left: auto; white-space: nowrap; color: var(--muted); font-size: 13px; }
.header-source span { color: var(--accent); padding-left: 3px; }
.main { padding: 25px 0 52px; min-height: calc(100vh - 140px); }
/* Board, Explore & Opportunities */
.board-hero, .detail-hero, .lookup-hero { border: 1px solid #e0e0f7; border-radius: 17px; background: var(--hero); }
.board-hero { display: flex; align-items: end; justify-content: space-between; padding: 24px 34px; gap: 26px; }
.source-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4e4d87; font-weight: 650; }
.source-label > span:not(.dot-grid) { color: #8583a5; }
.dot-grid { display: inline-grid; place-items: center; width: 9px; height: 9px; border-radius: 2px; background: var(--accent); flex: none; }
.hero-copy h1, .lookup-hero h1 { margin: 10px 0 8px; font-size: clamp(32px, 4vw, 51px); font-weight: 780; letter-spacing: -.055em; }
.hero-copy p, .detail-hero p, .lookup-hero p { color: #525776; }
.hero-copy p strong { color: var(--accent-hover); font-weight: 730; }
.hero-summary { display: grid; row-gap: 14px; }
.hero-stats { display: flex; gap: 25px; padding-bottom: 2px; }
.hero-stats > div { display: grid; gap: 5px; min-width: 120px; }
.hero-stats > div + div { padding-left: 26px; border-left: 1px solid #d4d3eb; min-width: 163px; }
.hero-stats strong { font-size: 31px; letter-spacing: -.07em; line-height: 1.1; white-space: nowrap; }
.hero-stats em { font-style: normal; color: #6d6d8f; font-size: 15px; letter-spacing: -.035em; }
.hero-stats > div > span, .sync { font-size: 13px; color: #535775; }
.numbers { font-variant-numeric: tabular-nums; font-family: var(--mono); }
.sync { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.sync i { display: inline-block; height: 6px; width: 6px; border-radius: 50%; background: var(--green); margin-right: 2px; }
.sync.pending i { background: #8b8da0; }
.board-section, .detail-section { margin-top: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.section-heading h2 { font-size: 25px; font-weight: 735; letter-spacing: -.04em; }
.section-heading p { color: var(--muted); margin-top: 4px; font-size: 13px; }
.board-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.board-update-status { color: var(--muted); font-size: 13px; margin: -7px 0 12px; }
.board-update-status:empty { margin: 0; }
.board-update-status a { color: var(--accent-hover); text-decoration: underline; margin-left: 4px; }
.archive { display: flex; align-items: center; justify-content: end; gap: 9px; color: var(--muted); font-size: 13px; white-space: nowrap; }
select { min-width: 125px; height: 37px; padding: 0 11px; border: 1px solid #d9dce9; border-radius: 8px; background: var(--white); color: var(--ink); font-size: 14px; }
.toolbar { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters, .region-filter { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.region-filter { gap: 8px; margin-right: 6px; color: var(--muted); font-size: 13px; }
.toggle, .secondary, .primary:not(:where(.ms-custom-app *)) {
  display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 37px;
  padding: 6px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--white);
  color: var(--ink); font-size: 14px; font-weight: 590; transition: background .16s ease, border-color .16s ease, color .16s ease, transform .12s ease;
}
.toggle.on { background: var(--accent-soft); border-color: #c9c5fb; color: var(--accent-hover); }
.toggle:hover, .secondary:hover { border-color: #b9b5ef; color: var(--accent-hover); }
.toggle:active, .secondary:active, .primary:not(:where(.ms-custom-app *)):active { transform: translateY(1px); }
.coverage { max-width: 100%; position: relative; align-self: center; color: #785718; font-size: 13px; }
.coverage summary { cursor: pointer; }
.coverage ul {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 0;
  width: max-content;
  max-width: min(80vw, 320px);
  max-height: 260px;
  overflow: auto;
  padding: 13px 13px 13px 27px;
  margin: 0;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 8px 28px #30305118;
  border: 1px solid var(--line);
  color: var(--muted);
}
.notice { margin-top: 13px; padding: 10px 14px; border-radius: 8px; background: #fff6e6; color: #6e5017; font-size: 14px; }
.grid { display: grid; grid-template-columns: 60px minmax(0, 1fr) 125px 120px 145px 34px; align-items: center; column-gap: 14px; padding: 0 20px; }
.table-heading { min-height: 42px; color: var(--muted); font-size: 12.5px; font-weight: 620; background: #eff1f9; border: 1px solid var(--line); border-radius: 11px 11px 0 0; }
.grow-head { text-align: right; padding-right: 14px; }
.trend-list {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 11px 11px;
  list-style: none;
  background: var(--white);
  overflow: clip;
  animation: appear .22s ease-out both;
}
.trend-row { position: relative; min-height: 66px; padding-block: 9px; transition: background .16s ease; }
.trend-row + .trend-row { border-top: 1px solid #eceef6; }
.trend-row:hover, .trend-row:focus-within { background: #f7f7ff; }
.rank { color: #666a83; font-size: 14px; }
.term-link { min-width: 0; display: grid; align-content: center; gap: 3px; justify-items: start; }
.term-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.term-link:focus-visible { outline: none; }
.trend-row:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
.term-link strong { font-size: 16px; font-weight: 685; line-height: 1.33; overflow-wrap: anywhere; }
.term-link small { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.mobile-count, .mobile-arrow, .mobile-status { display: none; }
.region-count { font-weight: 620; font-size: 15px; }
.region-count span { font: 13px var(--body); color: var(--muted); }
.growth { font-size: 17px; font-weight: 700; color: var(--accent-hover); white-space: nowrap; }
.trend-row .growth { text-align: right; padding-right: 14px; }
.when { font-size: 13px; display: grid; gap: 3px; color: var(--ink); }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.status i { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: currentColor; }
.status.active { color: var(--green); }
.status.quiet { color: var(--muted); }
.row-arrow { color: var(--accent); font-size: 18px; transition: transform .16s ease; display: inline-block; }
.trend-row:hover .row-arrow, .trend-row:focus-within .row-arrow { transform: translateX(3px); }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin: 17px 0 0; gap: 12px; color: var(--muted); }
.pagination a { justify-self: start; }
.pagination a:last-child { justify-self: end; }
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 23px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.footer a, .back, .source-link { color: var(--accent-hover); }
.footer a:hover, .header-source:hover, .source-link:hover, .back:hover { text-decoration: underline; }
.empty, .boot { border: 1px solid var(--line); border-radius: 11px; padding: 43px 18px; background: var(--white); text-align: center; color: var(--muted); }
.empty h2 { margin-bottom: 7px; font-size: 20px; color: var(--ink); }
.empty a { margin-top: 17px; }
.boot { display: flex; justify-content: center; align-items: center; gap: 9px; }
.spinner {
  display: inline-flex;
  width: 15px;
  height: 15px;
  border: 2px solid #deddf6;
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.back { display: inline-flex; padding: 0 0 16px; font-size: 14px; font-weight: 650; }
.detail-hero { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 27px 34px; }
.detail-hero h1 { font-size: clamp(29px, 5vw, 48px); letter-spacing: -.048em; overflow-wrap: anywhere; margin: 9px 0 7px; }
.detail-metric { display: grid; gap: 5px; white-space: nowrap; text-align: right; }
.detail-metric strong { font-size: 32px; letter-spacing: -.07em; color: var(--accent-hover); }
.detail-metric span { color: var(--muted); font-size: 13px; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 15px; font-size: 13px; }
.detail-actions a:hover { color: var(--accent-hover); }
.region-table { background: var(--white); border: 1px solid var(--line); border-radius: 11px; overflow: clip; }
.region-row {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(90px, 1fr) 120px 115px minmax(150px, 1fr) 77px;
  column-gap: 11px;
  min-height: 56px;
  padding: 8px 17px;
}
.region-row + .region-row { border-top: 1px solid #eceef6; }
.region-heading { min-height: 39px; color: var(--muted); background: #eff1f9; font-size: 13px; font-weight: 615; }
.region-row small, .region-time small { color: var(--muted); font-size: 12px; font-weight: 450; }
.region-time { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; }
.source-link { font-size: 13px; white-space: nowrap; }
.detail-bottom { display: grid; grid-template-columns: minmax(0, 2fr) minmax(215px, 1fr); gap: 26px; }
.related-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.related-chip, .archive-list a { border: 1px solid var(--line); background: var(--white); padding: 5px 10px; border-radius: 7px; overflow-wrap: anywhere; }
.related-chip { color: #454965; font-size: 13px; }
.related-chip:hover, .archive-list a:hover { color: var(--accent-hover); border-color: #b9b5ef; }
.archive-list { display: grid; gap: 7px; }
.archive-list a[aria-current] { color: var(--accent-hover); border-color: #c9c5fb; background: var(--accent-soft); }
.subtle { color: var(--muted); }
.lookup-hero { padding: 29px 35px 27px; }
.lookup-form { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.lookup-form input {
  flex: 1 1 150px;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid #d4d3ed;
  border-radius: 9px;
  font-size: 16px;
}
.lookup-form input::placeholder { color: #73778e; }
.primary:not(:where(.ms-custom-app *)) { min-height: 48px; padding-inline: 20px; background: var(--accent); color: var(--white); border-color: var(--accent); }
.primary:not(:where(.ms-custom-app *)):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.primary:not(:where(.ms-custom-app *)):disabled { opacity: .68; }
.lookup-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.lookup-meta span + span::before { content: "·"; margin-right: 14px; color: #888ba2; }
.lookup-result { margin-top: 22px; }
.lookup-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--white);
  animation: appear .22s ease-out;
  overflow: clip;
}
.lookup-row { display: grid; grid-template-columns: 43px minmax(0, 1fr) auto; align-items: center; min-height: 54px; padding: 8px 15px; column-gap: 8px; }
.lookup-row + .lookup-row { border-top: 1px solid #eceef6; }
.lookup-term { font-weight: 620; overflow-wrap: anywhere; }
.lookup-term:hover { color: var(--accent-hover); }
.lookup-term span { color: var(--accent); }
.breakout-tag { padding: 3px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-hover); font-weight: 660; }
.lookup-value, .lookup-note { color: var(--muted); }
.lookup-note { margin-top: 13px; font-size: 13px; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0,0,0,0); white-space: nowrap; overflow: hidden; }
.skip:focus { position: fixed; z-index: 3; top: 8px; left: 8px; background: var(--white); padding: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes appear { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 900px) {
  .wrap { width: calc(100% - 44px); }
  .grid { grid-template-columns: 42px minmax(0, 1fr) 75px 98px 111px 19px; gap: 9px; padding-inline: 13px; }
  .board-hero { padding-inline: 26px; }
  .hero-stats > div { min-width: 94px; }
  .hero-stats > div + div { min-width: 132px; padding-left: 17px; }
  .hero-stats { gap: 18px; }
  .region-row { grid-template-columns: minmax(70px, 1fr) 80px 85px minmax(125px, 1.15fr) 68px; }
}
@media (max-width: 660px) {
  .wrap { width: calc(100% - 28px); }
  .header-inner { min-height: 57px; gap: 20px; }
  .brand { font-size: 20px; gap: 7px; }
  .mark { width: 28px; height: 28px; font-size: 19px; border-radius: 7px; }
  .nav { gap: 17px; font-size: 13px; }
  .header-source { display: none; }
  .main { padding-top: 16px; }
  .board-hero { display: grid; align-items: start; border-radius: 13px; padding: 17px 16px 15px; gap: 13px; }
  .source-label { font-size: 12px; }
  .hero-copy h1 { margin: 7px 0 4px; letter-spacing: -.045em; }
  .hero-copy p { font-size: 13px; }
  .hero-summary { row-gap: 7px; }
  .hero-stats { gap: 13px; padding: 0; }
  .hero-stats > div { display: flex; gap: 6px; min-width: 0; align-items: baseline; }
  .hero-stats > div + div { padding-left: 11px; min-width: 0; }
  .hero-stats strong { font-size: 16px; letter-spacing: -.045em; }
  .hero-stats em, .hero-stats > div > span, .sync { font-size: 11.5px; }
  .board-section, .detail-section { margin-top: 19px; }
  .section-heading { flex-wrap: wrap; margin-bottom: 11px; align-items: center; }
  .section-heading h2 { font-size: 21px; }
  .section-heading p { font-size: 12px; margin-top: 3px; }
  .archive { font-size: 12px; gap: 5px; }
  .archive > span { display: none; }
  select { height: 34px; min-width: 100px; max-width: 142px; font-size: 13px; }
  .toolbar { margin-bottom: 9px; gap: 6px; }
  .filters { gap: 5px; }
  .region-filter { margin-right: 1px; }
  .region-filter > span { display: none; }
  .toggle { min-height: 34px; font-size: 12px; padding: 5px 8px; }
  .coverage ul { right: auto; left: 0; }
  .grid { grid-template-columns: 28px minmax(0, 1fr) 78px; padding-inline: 10px; gap: 7px; }
  .table-heading { min-height: 35px; font-size: 11.5px; }
  .table-heading > span:nth-child(3), .table-heading > span:nth-child(5), .table-heading > span:last-child, .region-count, .trend-row .when, .go { display: none; }
  .grow-head, .trend-row .growth { padding-right: 0; }
  .trend-row { min-height: 59px; padding-block: 8px; }
  .term-link strong { font-size: 14px; }
  .term-link small { font-size: 11.5px; }
  .mobile-count, .mobile-arrow { display: inline; }
  .mobile-arrow { color: var(--accent); }
  .mobile-status { display: block; line-height: 1.1; margin-top: 3px; }
  .mobile-status .status { font-size: 11px; }
  .growth { font-size: 14px; }
  .rank { font-size: 12px; }
  .detail-hero { padding: 18px 15px; border-radius: 13px; align-items: end; gap: 10px; }
  .detail-hero h1 { margin-top: 6px; }
  .detail-metric strong { font-size: 19px; }
  .detail-metric span, .detail-hero p { font-size: 12px; }
  .detail-bottom { grid-template-columns: 1fr; gap: 4px; }
  .region-row { grid-template-columns: minmax(0,1fr) 58px 60px 60px; padding: 8px 9px; gap: 3px 6px; }
  .region-row > strong { font-size: 13px; overflow-wrap: anywhere; }
  .region-row > .numbers { font-size: 12px; }
  .region-row .region-time { grid-column: 1 / 4; grid-row: 2; font-size: 12px; }
  .region-heading > span:nth-child(4) { display: none; }
  .region-row .source-link { grid-column: 4; grid-row: 1; font-size: 11px; }
  .lookup-hero { padding: 19px 15px; border-radius: 13px; }
  .lookup-hero h1 { margin-block: 7px 5px; }
  .lookup-form { margin-top: 14px; }
  .lookup-form input { padding: 7px 10px; }
  .primary:not(:where(.ms-custom-app *)) { padding-inline: 12px; }
  .lookup-row { grid-template-columns: 29px minmax(0, 1fr) auto; padding-inline: 10px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.geo-summary {
  max-width: 78ch;
  margin: 0 0 20px;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.8;
  border-radius: 0 8px 8px 0;
}
html[lang="en"] .header-inner { flex-wrap: wrap; }

.board-search,.root-tools,.lookup-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.board-search label,.lookup-form label {
  display: flex;
  gap: 8px;
  align-items: center;
}
.board-search input,.lookup-form select {
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  max-width: 100%;
}
.root-tools {
  margin: 24px 0;
}
.root-tools p {
  flex-basis: 100%;
}
.toolbar {
  flex-wrap: wrap;
}

/* Workbench shares the existing indigo and cool-gray design tokens. */
.board-actions { flex-wrap: wrap; justify-content: flex-end; }
.board-search { display: flex; gap: 6px; flex: 1 1 290px; }
.board-search input { min-width: 0; width: 100%; }
.workbench-filters, .quick-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; width: 100%; }
.quick-filters { margin-top: 14px; gap: 7px; }
.segment { display: flex; flex-wrap: wrap; gap: 2px; border: 1px solid var(--line); padding: 3px; border-radius: 9px; background: var(--paper); }
.segment .toggle { border: 0; border-radius: 6px; }
.board-section .growth { text-align: left; padding: 0; }
.row-actions { position: relative; z-index: 2; display: flex; gap: 10px; flex-wrap: wrap; color: var(--accent); font-size: 13px; }
.table-heading a { display: inline-block; padding-block: 8px; }
@media (max-width: 760px) {
  .board-section .section-heading { align-items: stretch; flex-direction: column; gap: 14px; }
  .board-actions { justify-content: flex-start; }
  .board-search { flex-basis: 100%; }
  .workbench-filters { gap: 9px; align-items: flex-start; }
  .segment { max-width: 100%; }
  .segment .toggle { padding: 7px 9px; }
  .board-section .table-heading { display: none; }
  .board-section .trend-row { grid-template-columns: 24px minmax(0, 1fr) 85px; gap: 8px; padding: 14px 10px; }
  .board-section .volume { grid-column: 2; font-size: 13px; color: var(--muted); }
  .board-section .trend-row .when { display: flex; grid-column: 2; grid-row: 3; gap: 8px; font-size: 12px; flex-wrap: wrap; }
  .board-section .row-actions { grid-column: 3; grid-row: 2 / 4; flex-direction: column; align-items: flex-start; }
  .board-section .mobile-status { display: none; }
  .board-section .rank { align-self: start; }
}
@media (min-width: 761px) {
  .board-section .section-heading > div:first-child { min-width: 0; }
  .board-actions { display: grid; grid-template-columns: minmax(210px, 1fr) auto auto; flex: 0 1 570px; }
}
.board-search { flex-wrap: nowrap; }
.board-search input { flex: 1 1 0; width: 0; }
.board-search button { flex: none; }
@media (min-width: 761px) and (max-width: 1050px) {
  .board-section .grid { padding-inline: 12px; }
}
.mobile-volume-label { display: none; }
@media (max-width: 760px) {
  .mobile-volume-label { display: inline; }
  .board-section .trend-list { border-top: 1px solid var(--line); border-radius: 11px; }
}
@media (min-width: 1100px) {
  .workbench-filters { gap: 8px; }
  .workbench-filters .toggle { font-size: 13px; padding-inline: 9px; }
  .workbench-filters .region-filter select { min-width: 110px; width: 110px; }
  .workbench-filters .archive select { min-width: 110px; width: 140px; }
}

/* Opportunity screening and evidence review */
#op-screen button, .op-review button {
  background: var(--accent);
  color: var(--white);
  border: 1px solid var(--accent);
  border-radius: 8px;
  min-height: 39px;
  padding: 6px 16px;
  font-weight: 590;
}
#op-screen button:hover, .op-review button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
#op-single button {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 39px;
  padding: 6px 14px;
  font-weight: 590;
}
#op-single button:hover {
  border-color: #b9b5ef;
  color: var(--accent-hover);
}
.op-controls,.op-card {
  background: #fff;
  border: 1px solid var(--line,#e0e5ef);
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
}
.op-controls form,.op-controls fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}
.op-controls form+form {
  margin-top: 18px;
}
.op-controls fieldset,.op-review fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.op-controls label,.op-review label {
  display: grid;
  gap: 7px;
  font-size: 14px;
  color: #475569;
}
.op-controls input,.op-controls select,.op-review input,.op-review select,.op-review textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
  color: #172033;
  max-width: 100%;
}
.op-review textarea {
  min-height: 85px;
  resize: vertical;
  width: 100%;
}
.op-review fieldset {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}
.op-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.op-card h2 {
  margin: 0;
}
.op-card h3 {
  font-size: 15px;
}
.op-card p,.op-card dd {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}
.op-card dl {
  display: grid;
  grid-template-columns: 120px minmax(0,1fr);
  gap: 10px;
}
.op-card dt {
  color: #64748b;
}
.op-card dd {
  margin: 0;
}
.op-card li {
  margin: 12px 0;
}
.op-card details {
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
  margin-top: 16px;
}
.op-card summary {
  cursor: pointer;
  color: #4338ca;
  font-weight: 600;
}
.op-tag {
  display: inline-block;
  padding: 4px 9px;
  background: #eef2ff;
  color: #4338ca;
  border-radius: 6px;
  font-size: 12px;
}
.op-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}
.op-filters [aria-pressed=true] {
  background: #4338ca;
  color: white;
}
.op-card[hidden] {
  display: none;
}
#op-meter {
  width: 100%;
  height: 8px;
  accent-color: #4f46e5;
}
.nav,.row-actions {
  flex-wrap: wrap;
}
.op-card a {
  overflow-wrap: anywhere;
}
.op-controls button,.op-review button,.op-filters button {
  transition: background .15s,opacity .15s;
}
.op-controls button:disabled {
  opacity: .55;
}
.op-review:focus-within {
  outline: 2px solid #e0e7ff;
  outline-offset: 8px;
}
@media(max-width:640px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
  }
  .nav {
    gap: 14px;
  }
  .op-controls,.op-card {
    padding: 16px;
  }
  .op-controls form,.op-controls fieldset {
    width: 100%;
  }
  .op-controls label {
    flex: 1;
    min-width: 120px;
  }
  .op-card dl {
    grid-template-columns: 1fr;
  }
  .op-card dd {
    margin-bottom: 8px;
  }
}

/* Keep the first view focused on the decision; evidence and plans open on demand. */
.op-hero { padding-block: 28px; }
.op-hero h1 { margin-top: 0; }
.op-hero p { max-width: 760px; }
.op-main-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 20px 28px; }
.op-main-controls form + form { margin-top: 0; }
.op-controls .op-single-wrap { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.op-single-wrap summary, .op-spec-wrap summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.op-single-wrap[open] summary { margin-bottom: 16px; }
#op-progress:empty, .op-review-status:empty, #op-meter[hidden] { display: none; }
#op-progress { margin-bottom: 0; }
#op-meter:not([hidden]) { display: block; margin-top: 12px; }
.op-card { padding: 22px 24px; }
.op-heading { min-width: 0; flex: 1 1 260px; }
.op-heading h2 { font-size: 21px; overflow-wrap: anywhere; }
.op-card .op-meta { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.op-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.op-verdict { display: inline-block; padding: 6px 11px; border-radius: 8px; font-size: 14px; font-weight: 650; }
.op-verdict.is-build { background: #ecfdf3; color: #166534; }
.op-verdict.is-needs_evidence { background: #fffbeb; color: #92400e; }
.op-verdict.is-skip { background: #f1f5f9; color: #475569; }
.op-card .op-summary { font-size: 17px; line-height: 1.7; color: var(--ink, #172033); margin: 18px 0 12px; }
.op-card .op-facts { font-size: 14px; grid-template-columns: 110px minmax(0, 1fr); gap: 7px 16px; margin: 0; }
.op-card > details { margin-top: 16px; padding-top: 12px; }
.op-card > details > summary { font-size: 14px; font-weight: 590; }
.op-evidence section { margin-top: 20px; }
.op-review-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.op-review button { justify-self: start; }
.op-review textarea[name=note] { min-height: 60px; }
.op-card .op-spec-wrap { margin-top: 0; padding-top: 14px; }
.op-spec-fields { display: grid; gap: 16px; padding-top: 18px; }
@media (max-width: 640px) {
  .op-main-controls { gap: 16px; }
  .op-card { padding: 18px 16px; }
  .op-card header { gap: 10px; }
  .op-heading { flex-basis: 100%; }
  .op-heading h2 { font-size: 19px; }
  .op-card .op-summary { font-size: 16px; }
  .op-card .op-facts { grid-template-columns: 1fr; gap: 4px; }
  .op-review-choices { grid-template-columns: 1fr; }
  .op-single-wrap summary, .op-spec-wrap summary { line-height: 1.6; }
}

/* Demand analysis stays beside the keyword, without opening a workbench. */
.row-actions .row-analyze {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.row-analyze:hover { color: var(--accent-hover); text-decoration: underline; }
.row-analyze:disabled { opacity: .55; cursor: wait; }
.term-link .term-analysis, .detail-hero .term-analysis {
  display: block;
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}
.term-analysis.is-build b { color: #15803d; }
.term-analysis.is-needs_evidence b { color: #b45309; }
.term-analysis.is-skip b { color: #64748b; }
.lookup-row { grid-template-columns: 43px minmax(0,1fr) auto auto; column-gap: 12px; }
.lookup-item { min-width:0; display:grid; gap:3px; justify-items:start; }
.lookup-item .term-analysis {
  display: block;
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Compact headers and a single coherent workbench. */
.geo-summary { max-width:none; margin:8px 0 0; padding:0 4px; border:0; background:transparent; color:var(--muted); font-size:12.5px; line-height:1.5; }
.board-hero,.lookup-hero,.detail-hero { padding:18px 26px; }
.board-hero h1,.lookup-hero h1,.detail-hero h1 { font-size:clamp(26px,3.2vw,36px); }
.board-section { background:var(--white); border:1px solid var(--line); border-radius:16px; padding:20px 22px; margin-top:16px; box-shadow:0 2px 10px rgba(23,25,45,.03); }
.board-section .toolbar { border-top:1px solid #eef0f7; padding-top:14px; margin-top:12px; }
.board-section .trend-list { border-radius:10px; }
.lookup-form { display:flex; flex-direction:column; align-items:stretch; gap:14px; }
.lookup-search-row { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.lookup-search-row #lookup-input { flex:1 1 220px; min-width:0; }
.lookup-options { display:flex; flex-wrap:wrap; gap:12px 18px; }
.lookup-options label { display:grid; gap:5px; font-size:13px; color:var(--muted); }
.lookup-form select { height:40px; padding:0 11px; }
#batch-expand { min-height:36px; padding:6px 14px; font-size:13.5px; }
#cancel-expand[hidden] { display:none; }
.nav { flex:1; }
.nav a:last-child { margin-left:auto; padding:4px 10px; border:1px solid var(--line); border-radius:7px; font-size:13px; align-self:center; }
.row-actions .row-analyze { padding:2px 8px; border-radius:6px; background:var(--accent-soft); color:var(--accent-hover); font-size:12.5px; font-weight:620; text-decoration:none; }
:is(.term-info, .term-link, .lookup-item, .detail-hero) .term-analysis.is-build { background:#f0fdf4; border:1px solid #bbf7d0; color:#14532d; }
:is(.term-info, .term-link, .lookup-item, .detail-hero) .term-analysis.is-needs_evidence { background:#fffbeb; border:1px solid #fde68a; color:#78350f; }
:is(.term-info, .term-link, .lookup-item, .detail-hero) .term-analysis.is-skip { background:#f8fafc; border:1px solid #e2e8f0; color:#475569; }
.term-analysis.is-build b { color:#15803d; margin-right:4px; }
.term-analysis.is-needs_evidence b { color:#b45309; margin-right:4px; }
.term-analysis.is-skip b { color:#64748b; margin-right:4px; }
@media(max-width:660px) {
 .board-section { padding:14px 12px; border-radius:13px; }
 .lookup-form select { height:36px; padding:0 10px; }
 .board-hero,.lookup-hero,.detail-hero { padding:16px; }
 .lookup-options { gap:10px; }
 .lookup-options label { flex:1 1 120px; min-width:0; }
 .lookup-options select { max-width:100%; }
 .nav { flex-basis:100%; }
}
/* Micro-Sites & Preview Modal */
.term-info {
  min-width: 0;
}
.term-info .term-analysis {
  display: block;
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.term-site-btn,.term-site-link {
  position: relative;
  z-index: 2;
  margin: 4px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
}
.term-site-btn.is-primary {
  background: var(--accent);
  color: white;
}
.term-site-live {
  color: #15803d;
}
.term-site-status {
  display: block;
}
.tool-owner,.tool-widget,.tool-content {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin: 18px 0;
}
.tool-owner,.tool-presets,#tool-runner {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}
#tool-runner label:not(:where(.ms-custom-app *)) {
  display: grid;
  gap: 8px;
  flex: 1;
  min-width: 160px;
}
#tool-runner input:not(:where(.ms-custom-app *)),#tool-runner select:not(:where(.ms-custom-app *)) {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tool-presets {
  margin-top: 16px;
}
#tool-output {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 60px;
}
.tool-table {
  overflow: auto;
}
.tool-table table {
  border-collapse: collapse;
  width: 100%;
}
.tool-table td,.tool-table th {
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
}
.tool-content section {
  margin: 24px 0;
}
.tool-content p {
  line-height: 1.8;
}
.tool-content a {
  overflow-wrap: anywhere;
}
@media(max-width:660px) {
  .tool-owner,.tool-widget,.tool-content {
    padding: 14px;
  }
}

#tool-runner select:not(:where(.ms-custom-app *)), .tool-card select:not(:where(.ms-custom-app *)) {
  height: 40px;
  padding: 0 11px;
}
.board-hero h1, .lookup-hero h1, .detail-hero h1, .tool-hero h1 {
  line-height: 1.32;
}
@media (max-width: 660px) {
  #tool-runner select:not(:where(.ms-custom-app *)), .tool-card select:not(:where(.ms-custom-app *)) {
    height: 38px;
    padding: 0 10px;
  }
}
.sites-grid,.tool-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
  gap: 16px;
}
.sites-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.site-card,.tool-card,.tool-section-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  min-width: 0;
}
.site-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.site-card header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.site-card h2 {
  width: 100%;
  margin: 0;
  font-size: 21px;
}
.site-card p {
  margin: 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.site-card footer {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.site-status {
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 12px;
}
.site-status.is-published {
  background: #dcfce7;
  color: #166534;
}
.site-status.is-draft {
  background: #fef3c7;
  color: #92400e;
}
.site-card[hidden] {
  display: none;
}
.tool-content {
  background: transparent;
  border: 0;
  padding: 0;
}
.tool-content .tool-card {
  margin: 16px 0;
}
.tool-content .tool-section-card {
  margin: 0;
}
.tool-card details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
}
.tool-result-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-top: 18px;
}
.tool-checks {
  font-size: 13px;
  color: #166534;
}
.term-site-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-top: 1px solid rgba(100,116,139,.15);
  margin-top: 7px;
  padding-top: 5px;
}
.term-analysis {
  border-radius: 10px;
}
.is-confirm {
  color: #166534;
  background: #dcfce7;
}
.term-gen-progress {
  display: block;
  width: min(100%,360px);
  height: 9px;
  accent-color: var(--accent);
  margin: 8px 0;
}
.term-gen-stage {
  font-size: 13px;
}
.term-site-status small {
  display: block;
  color: var(--muted);
}
@media(max-width:660px) {
  .sites-grid,.tool-sections-grid {
    grid-template-columns: minmax(0,1fr);
  }
  .tool-card,.tool-section-card,.site-card {
    padding: 16px;
  }
}
.ms-hero {
  background: linear-gradient(135deg,#1e1b4b,#312e81 55%,#4338ca);
  color: #fff;
  border-radius: 18px;
  padding: 28px 32px;
  box-shadow: 0 12px 32px #312e812e;
}
.ms-hero h1 {
  color: #fff;
  font-size: clamp(24px,3vw,34px);
  line-height: 1.32;
  margin: 12px 0 8px;
}
.ms-hero .ms-subtitle {
  color: #e0e7ff;
  font-size: 15px;
}
.ms-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ms-badges span {
  padding: 5px 10px;
  background: #ffffff18;
  border: 1px solid #ffffff30;
  border-radius: 20px;
  font-size: 12px;
}
.ms-hero+.geo-summary {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e1b4b;
  padding: 12px 16px;
  border-radius: 12px;
  margin: 14px 0 0;
  font-size: 13.5px;
  line-height: 1.65;
}
.tool-widget.ms-studio {
  display: grid;
  grid-template-columns: minmax(260px,1fr) minmax(300px,1.15fr);
  gap: 22px;
  align-items: stretch;
}
.ms-controls-pane #tool-runner {
  display: grid;
  gap: 16px;
}
.ms-controls-pane #tool-runner button:not(:where(.ms-custom-app *)) {
  width: 100%;
  background: linear-gradient(120deg,#4338ca,#6366f1);
}
.ms-controls-pane h3 {
  margin: 0 0 18px;
}
.tool-result-card.ms-result-pane {
  margin: 0;
  background: linear-gradient(#f8fafc,#f1f5f9);
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ms-result-heading {
  font-weight: 650;
  color: #4338ca;
}
.ms-result-pane #tool-output {
  font-family: var(--body,inherit);
  font-size: 15px;
  line-height: 1.75;
  color: #0f172a;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0;
  flex: 1;
}
.ms-result-pane #tool-copy {
  align-self: end;
}
.ms-table-card .tool-table {
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ms-table-card th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 650;
}
.ms-table-card td:first-child {
  font-weight: 620;
  color: #1e293b;
}
.ms-table-card tbody tr:nth-child(even) {
  background: #f8fafc;
}
.ms-table-card tbody tr:hover {
  background: #eef2ff;
}
.ms-index {
  display: inline-block;
  padding: 5px 9px;
  background: #e0e7ff;
  color: #4338ca;
  border-radius: 7px;
  font-weight: 650;
}
.tool-section-card ul {
  list-style: none;
  padding: 0;
}
.tool-section-card li {
  position: relative;
  padding-left: 24px;
  margin: 10px 0;
}
.tool-section-card li:before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #4338ca;
}
.ms-bottom-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.source-host {
  display: block;
  padding: 4px 7px;
  background: #eef2ff;
  border-radius: 6px;
  color: #4338ca;
  font-size: 12px;
}
.tool-sources-card ul {
  padding-left: 18px;
}
.tool-sources-card li {
  margin: 12px 0;
}
.has-preview-modal {
  overflow: hidden;
}
.preview-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #0f172a80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(5px);
}
.preview-modal-card {
  max-width: 980px;
  width: calc(100vw - 32px);
  max-height: 88vh;
  border-radius: 20px;
  background: #f8fafc;
  box-shadow: 0 25px 70px #0f172a47;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.preview-modal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  flex-shrink: 0;
}
.preview-modal-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}
.preview-modal-close {
  border: 0;
  background: #f1f5f9;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}
.modal-dots {
  display: flex;
  gap: 4px;
}
.modal-dots i {
  width: 8px;
  height: 8px;
  background: #f87171;
  border-radius: 50%;
}
.modal-dots i:nth-child(2) {
  background: #fbbf24;
}
.modal-dots i:nth-child(3) {
  background: #4ade80;
}
.preview-modal-body {
  overflow: auto;
  padding: 22px;
  overscroll-behavior: contain;
}
@media(max-width:700px) {
  .tool-widget.ms-studio,.ms-bottom-grid {
    grid-template-columns: minmax(0,1fr);
  }
  .ms-hero {
    padding: 22px 18px;
  }
  .preview-modal-body {
    padding: 12px;
  }
  .preview-modal-card {
    max-height: 92vh;
  }
  .preview-modal-actions {
    margin-left: 0;
  }
  .ms-controls-pane #tool-runner label:not(:where(.ms-custom-app *)) {
    min-width: 0;
  }
}

.ms-result-pane {
  position: relative;
}
.ms-result-pane #tool-copy {
  position: absolute;
  top: 12px;
  right: 14px;
}
.ms-result-heading {
  padding-right: 100px;
}
.ms-controls-pane .tool-presets {
  margin: 0 0 18px;
}
.ms-controls-pane .tool-presets>span {
  font-size: 12px;
  color: var(--muted);
}
.ms-page {
  --ms-bg: #eef2ff;
  --ms-hero: #1e1b4b;
  --ms-accent: #4f46e5;
  --ms-soft: #eef2ff;
  --ms-border: #c7d2fe;
  --ms-ink: #1e1b4b;
  --ms-badge-bg: #ffffff20;
}
.ms-page.theme-emerald {
  --ms-bg: #ecfdf5;
  --ms-hero: #064e3b;
  --ms-accent: #059669;
  --ms-soft: #ecfdf5;
  --ms-border: #a7f3d0;
  --ms-ink: #064e3b;
  --ms-badge-bg: #d1fae530;
}
.ms-page.theme-ocean {
  --ms-bg: #f0f9ff;
  --ms-hero: #0c4a6e;
  --ms-accent: #0284c7;
  --ms-soft: #f0f9ff;
  --ms-border: #bae6fd;
  --ms-ink: #0c4a6e;
  --ms-badge-bg: #e0f2fe25;
}
.ms-page.theme-amber {
  --ms-bg: #fffbeb;
  --ms-hero: #78350f;
  --ms-accent: #d97706;
  --ms-soft: #fffbeb;
  --ms-border: #fde68a;
  --ms-ink: #78350f;
  --ms-badge-bg: #fef3c730;
}
.ms-page.theme-rose {
  --ms-bg: #fff1f2;
  --ms-hero: #881337;
  --ms-accent: #e11d48;
  --ms-soft: #fff1f2;
  --ms-border: #fecdd3;
  --ms-ink: #881337;
  --ms-badge-bg: #ffe4e625;
}
.ms-page.theme-slate {
  --ms-bg: #f8fafc;
  --ms-hero: #0f172a;
  --ms-accent: #475569;
  --ms-soft: #f8fafc;
  --ms-border: #cbd5e1;
  --ms-ink: #0f172a;
  --ms-badge-bg: #e2e8f025;
}
.ms-page.theme-indigo {
  --ms-bg: #eef2ff;
  --ms-hero: #1e1b4b;
  --ms-accent: #4f46e5;
  --ms-soft: #eef2ff;
  --ms-border: #c7d2fe;
  --ms-ink: #1e1b4b;
  --ms-badge-bg: #e0e7ff25;
}
.ms-page .ms-hero {
  background: linear-gradient(125deg,var(--ms-hero),var(--ms-accent));
  box-shadow: none;
}
.ms-page .ms-badges span {
  background: var(--ms-badge-bg);
}
.ms-page .geo-summary,.ms-page .ms-stat {
  background: var(--ms-soft);
  border-color: var(--ms-border);
  color: var(--ms-ink);
}
.ms-page .primary:not(:where(.ms-custom-app *)),.ms-page #tool-runner button:not(:where(.ms-custom-app *)) {
  background: var(--ms-accent);
  border-color: var(--ms-accent);
}
.ms-page .ms-index,.ms-page .source-host {
  background: var(--ms-soft);
  color: var(--ms-accent);
}
.ms-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(140px,1fr));
  gap: 12px;
  margin: 16px 0;
}
.ms-stat {
  border: 1px solid;
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 8px;
}
.ms-stat strong {
  font-size: 22px;
  overflow-wrap: anywhere;
}
.ms-stat span {
  font-size: 12px;
}
.ms-page .ms-guide-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin: 22px 0;
}
.ms-page .is-roadmap {
  grid-template-columns: 1fr;
  border-left: 2px solid var(--ms-border);
  padding-left: 20px;
}
.ms-guide-body .ms-studio {
  grid-template-columns: 1fr;
  align-self: start;
  position: sticky;
  top: 16px;
  margin: 0;
}
.layout-calculator .ms-hero {
  padding: 16px 24px;
}
.layout-calculator .ms-studio {
  grid-template-columns: 1fr 1.4fr;
}
.layout-calculator #tool-output {
  font-size: 23px;
}
.layout-versus .ms-hero {
  border-radius: 0 24px 0 24px;
}
.layout-versus .ms-stat strong {
  font-size: 28px;
}
.layout-briefing .ms-hero {
  background: var(--ms-soft);
  color: var(--ms-ink);
  border-top: 5px solid var(--ms-accent);
}
.layout-briefing .ms-hero h1,.layout-briefing .ms-subtitle {
  color: var(--ms-ink);
}
.layout-briefing .tool-sections-grid {
  grid-template-columns: repeat(3,minmax(0,1fr));
}
.preview-modal-footer {
  padding: 12px 18px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}
.preview-modal-footer .is-primary,.tool-owner>.is-primary {
  font-size: 15px;
  padding: 10px 18px;
}
.tool-owner {
  border: 2px solid #c7d2fe;
  box-shadow: 0 6px 20px #312e8112;
}
@media(max-width:700px) {
  .ms-page .ms-guide-body,.layout-calculator .ms-studio,.layout-briefing .tool-sections-grid {
    grid-template-columns: 1fr;
  }
  .ms-guide-body .ms-studio {
    position: static;
  }
  .ms-highlights {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .preview-modal-footer {
    flex-wrap: wrap;
    justify-content: center;
  }
}

.term-site-btn.is-danger{background:#fef2f2;color:#b91c1c;border:1px solid #fecaca}.term-site-btn.is-danger:hover{background:#fee2e2}

.tool-widget.ms-studio.ms-custom-app{display:block;min-width:0;overflow:auto}.ms-custom-app svg{max-width:100%;height:auto}.ms-custom-app input[type=range]{width:100%}

:where(.ms-custom-app button) {
  background: var(--ms-soft, #f1f5f9);
  color: var(--ms-ink, #1e293b);
}
.ms-custom-app input[type="checkbox"], .ms-custom-app input[type="radio"] {
  width: auto;
  display: inline-block;
  margin: 0 6px 0 0;
  padding: 0;
  flex: 0 0 auto;
}
.ms-custom-app input[type="range"] {
  padding: 0;
  border: 0;
  background: transparent;
}

/* Shared surfaces and controls. Bespoke applications keep their own control styles. */

body { background: radial-gradient(ellipse at 50% 0, #e2e8f066, transparent 650px), var(--paper); }
.board-hero, .lookup-hero, .detail-hero:not(.ms-hero), .hero, .explore-hero, .tools-hero {
  background: #fff radial-gradient(rgba(15,23,42,.06) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px #0f172a0a, 0 8px 24px -12px #0f172a0f;
}
.board-section, .site-card, .tool-card, .tool-section-card, .tool-widget, .op-card, .op-controls, .tool-owner, .ms-stat, .tool-result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px #0f172a04;
}
.board-section, .preview-modal-card { border-radius: var(--radius-lg); }
:is(button, input:not([type=checkbox]):not([type=radio]):not([type=range]), select, .primary, .secondary, .term-site-link):not(:where(.ms-custom-app *)) {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background .2s, border-color .2s, box-shadow .2s, transform .25s var(--ease-spring);
}
:is(button, .primary, .secondary, .term-site-link):not(:where(.ms-custom-app *)) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  background: #fff;
  color: var(--ink);
  border: 1px solid rgba(15,23,42,.12);
  box-shadow: 0 1px 2px #0f172a0a;
}
:is(button, .secondary, .term-site-link):not(:where(.ms-custom-app *)):hover {
  background: #f8fafc;
  border-color: rgba(15,23,42,.24);
  transform: translateY(-1px);
}
:is(.primary, .term-site-btn.is-primary, #op-screen button, .op-review button, .ms-page #tool-runner button):not(:where(.ms-custom-app *)) {
  background: #0f172a;
  border: 1px solid #0f172a;
  color: #fff;
  box-shadow: inset 0 1px 0 #ffffff29, 0 1px 2px #0f172a29;
}
:is(.primary, .term-site-btn.is-primary, #op-screen button, .op-review button, .ms-page #tool-runner button):not(:where(.ms-custom-app *)):hover {
  background: #1e293b;
  color: #fff;
}
:is(button, .primary, .secondary):not(:where(.ms-custom-app *)):active { transform: scale(.98); }
:is(button, a, input, select, textarea):focus-visible { outline: 2px solid #64748b; outline-offset: 3px; }
:is(.term-site-btn.is-danger, [data-delete-slug], [data-publish-action=delete]):not(:where(.ms-custom-app *)) { background:#fff1f2; border:1px solid #e11d4833; color:#be123c; }
:is(.term-site-btn.is-danger, [data-delete-slug], [data-publish-action=delete]):not(:where(.ms-custom-app *)):hover { background:#ffe4e6; }
:is(.term-site-btn, .term-site-link, .toolbar button, .toolbar .secondary, .tool-card-actions a, .tool-card-actions button, .tool-presets button, .ms-owner-actions button):not(:where(.ms-custom-app *)) {
  height:30px; min-height:30px; padding:0 10px; border-radius:7px; font-size:12.5px; font-weight:500; margin:0;
}
.row-actions { display:flex; align-items:center; flex-wrap:nowrap; gap:5px; white-space:nowrap; }
.row-actions :is(a, button.row-analyze) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-height: 28px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  background: #fff;
  text-decoration: none;
}
.row-actions :is(a, button.row-analyze):hover { background:#f1f5f9; color:#0f172a; }
.board-section .grid { grid-template-columns:36px minmax(160px,1fr) 80px 80px 120px 205px; gap:12px; }
.ms-owner-bar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; padding:10px 16px; background:#ffffffeb; backdrop-filter:blur(12px); }
.ms-owner-meta, .ms-owner-actions { display:flex; align-items:center; flex-wrap:wrap; gap:10px; font-size:12px; color:var(--muted); }
.ms-owner-meta a { color:var(--ink); }
.ms-page .ms-hero, .ms-page.layout-briefing .ms-hero {
  background:radial-gradient(ellipse at 90% 0, #ffffff18, transparent 65%), #0f172a;
  color:#fff; border:1px solid var(--line); border-radius:var(--radius-lg); padding:26px 28px;
}
.ms-page .ms-hero h1 { color:#fff; }
.ms-page .ms-hero .ms-subtitle { color:#cbd5e1; }
.ms-page .ms-hero + .geo-summary { background:#fff; color:#475569; border:1px solid var(--line); border-left:3px solid var(--ms-accent); border-radius:var(--radius-sm); }
.ms-highlights { grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); }
.ms-page .ms-stat { background:#fff; color:var(--ink); border-color:var(--line); }
.ms-stat .ms-highlight-val { font-size:clamp(.95rem,1.25vw,1.15rem); line-height:1.35; overflow-wrap:break-word; word-break:normal; }
#tool-custom-root { width:100%; max-width:none; margin-inline:0; box-shadow:none; }
#tool-custom-root > .ms-custom-runner { display:block; width:100%; min-width:0; }
.sites-grid, .tools-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:18px; align-items:stretch; }
.site-card { display:flex; flex-direction:column; justify-content:space-between; gap:12px; padding:20px; background:#fff; border-radius:14px; }
.site-card header { align-items:center; gap:8px; }
.site-card h2 { font-size:20px; line-height:1.4; }
.site-summary { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; color:#475569; }
.site-card .tool-card-actions { margin-top:auto; padding-top:14px; border-top:1px solid #f1f5f9; display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
:is(.site-card, .tool-card, .tool-section-card, .ms-stat, .ms-runner-card, .board-section) { position:relative; isolation:isolate; }
:is(.site-card, .tool-card, .tool-section-card, .ms-stat, .ms-runner-card, .board-section)::before {
  content:''; position:absolute; inset:0; border-radius:inherit; pointer-events:none; z-index:-1; opacity:0;
  background:radial-gradient(420px circle at var(--mouse-x,50%) var(--mouse-y,50%), rgba(79,70,229,.055), transparent 40%);
  transition:opacity .3s var(--ease-spring);
}
@media(hover:hover) {
  :is(.site-card, .tool-card, .tool-section-card, .ms-stat, .ms-runner-card, .board-section):hover::before { opacity:1; }
  .site-card:hover { box-shadow:0 8px 24px -12px #0f172a26; }
}
@keyframes surface-enter { from { opacity:0; transform:translateY(9px); } to { opacity:1; transform:translateY(0); } }
.site-card, .tool-section-card, .ms-stat { animation:surface-enter .55s var(--ease-spring) both; }
:is(.site-card, .tool-section-card, .ms-stat):nth-child(2) { animation-delay:45ms; }
:is(.site-card, .tool-section-card, .ms-stat):nth-child(3) { animation-delay:90ms; }
.preview-modal-card { animation:surface-enter .35s var(--ease-spring) both; }
@media(max-width:1050px) {
  .board-section .grid { grid-template-columns:30px minmax(150px,1fr) 70px 70px 85px 205px; gap:8px; }
}
@media(max-width:760px) {
  .board-section .trend-row { grid-template-columns:24px minmax(0,1fr) 85px; }
  .board-section .trend-row .row-actions { grid-column:2 / -1; justify-self:start; }
}
@media(max-width:660px) {
  .sites-grid, .tools-grid { grid-template-columns:minmax(0,1fr); }
  .ms-highlights { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .ms-page .ms-hero { padding:22px 18px; }
  .ms-owner-bar { padding:12px; }
  .ms-owner-actions { width:100%; }
  .lookup-search-row { align-items:stretch; }
  .lookup-search-row #lookup-input { flex-basis:100%; }
}
@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}

/* Legacy ID selectors share the same control metrics. */
:is(#op-screen button, #op-single button, .op-review button, #lookup-input, #lookup-geo, #lookup-type, #lookup-source, #tool-runner input, #tool-runner select):not(:where(.ms-custom-app *)) {
  height:36px; min-height:36px; padding:0 14px; border-radius:8px; font-size:13px; font-weight:500;
}
:is(.toolbar, .lookup-options, #tool-runner) select:not(:where(.ms-custom-app *)), .board-search input { border:1px solid rgba(15,23,42,.12); }
.table-heading { background:#f8fafc; }
@media(max-width:760px) {
  .board-section .trend-row .row-actions { grid-row:auto; flex-direction:row; align-items:center; }
  .board-section .toolbar { gap:10px; }
  .board-section .category-filters { gap:5px; }
  .category-filters .toggle { height:30px; min-height:30px; padding:0 8px; }
}
.site-card header h2 { min-height:2.8em; }
.site-card .tool-card-actions { min-height:82px; align-content:flex-start; }
.site-card .term-site-btn.is-primary { height:30px; min-height:30px; padding:0 10px; }
@media(max-width:660px) { .site-card header h2 { min-height:0; } .site-card .tool-card-actions { min-height:0; } }
.ms-page .ms-stat .ms-highlight-val { font-size:clamp(.95rem,1.25vw,1.15rem); line-height:1.35; overflow-wrap:break-word; word-break:normal; }
.site-card .tool-card-actions { height:88px; flex:0 0 88px; align-items:flex-start; align-content:flex-start; }
@media(max-width:660px) { .site-card .tool-card-actions { height:auto; flex-basis:auto; } }
[hidden] { display:none !important; }

/* Keep site actions on one compact line, including saved app previews. */
.tool-card-actions .tool-inline-status,
.tool-card-actions .term-site-live { display:none; }
.site-card .tool-card-actions, .tool-card-actions {
  gap:6px;
  flex-wrap:nowrap;
  height:auto;
  min-height:45px;
  flex-basis:auto;
  overflow-x:auto;
}
.site-card .tool-card-actions :is(a, button, .term-site-btn.is-primary) {
  flex-shrink:0;
  padding:0 6px;
}
.ms-runner-card .ms-custom-app, #tool-custom-root .ms-custom-app {
  max-width:none !important;
  width:100%;
}

:is(.site-card, .tool-card, .tool-section-card, .ms-stat, .ms-runner-card, .board-section)::before {
  background: radial-gradient(520px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(99, 102, 241, .16), rgba(129, 140, 248, .06) 45%, transparent 70%);
}
.trend-row:hover, .trend-row:focus-within, .lookup-row:hover, .region-row:hover {
  background: #eceeff;
}
:is(button, .secondary, .toggle, .term-site-link):not(:where(.ms-custom-app *)):hover {
  background: #f0effe;
  border-color: #818cf8;
  color: #3730a3;
}
:is(.toggle.on, .sites-filters button[aria-pressed="true"], .op-filters button[aria-pressed="true"]),
:is(.toggle.on, .sites-filters button[aria-pressed="true"], .op-filters button[aria-pressed="true"]):hover {
  background: #e0e7ff;
  border-color: #6366f1;
  color: #312e81;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 2px rgba(79, 70, 229, .12);
}
.board-section .quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
}
.quick-filters > .toggle {
  border-radius: 999px;
  padding: 0 13px;
  height: 32px;
  min-height: 32px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}
.board-section .category-filters {
  flex: 1 0 100%;
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  overflow: visible;
}
.category-filters .toggle {
  height: 30px;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 12.5px;
  background: #fff;
  border: 1px solid #dbe2ee;
  color: #334155;
}
.quick-filters > .toggle:hover, .category-filters .toggle:hover {
  background: #f0effe;
  border-color: #818cf8;
  color: #3730a3;
}
.board-section .quick-filters > .toggle.on,
.board-section .quick-filters > .toggle.on:hover {
  background: #e0e7ff;
  border-color: #6366f1;
  color: #312e81;
}
.board-section .category-filters .toggle.on,
.board-section .category-filters .toggle.on:hover {
  background: #4f46e5;
  border-color: #4338ca;
  color: #fff;
}

.sites-filter-status {
  color: var(--muted);
  margin-bottom: 12px;
}
.sites-filter-status:empty {
  display: none;
}

/* Live search workbench */
.lookup-hero {
  padding: 22px 26px;
  display: grid;
  gap: 14px;
}
.lookup-hero .lookup-form {
  max-width: none;
  width: 100%;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(238, 240, 247, .28);
  gap: 12px;
}
.lookup-search-row #lookup-input,
.lookup-search-row .primary,
.lookup-search-row #lookup-google {
  height: 42px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
}
.lookup-search-row #lookup-input {
  font-size: 14.5px;
  padding: 0 14px;
}
.lookup-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 240px));
  gap: 12px 16px;
  align-items: end;
}
.lookup-options label {
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}
.lookup-options select { width: 100%; }
.lookup-meta {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px dashed rgba(226, 232, 240, .35);
  font-size: 12.5px;
}
.root-tools {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 18px;
  margin: 14px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
.root-tools > p:first-child {
  flex-basis: auto;
  margin: 0 6px 0 0;
  font-size: 13px;
  font-weight: 650;
  color: #1e293b;
  white-space: nowrap;
}
.root-tools [data-root] {
  height: 30px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #dbe2ee;
  font-size: 12.5px;
}
.root-tools [data-root]:hover { background: #f0effe; border-color: #818cf8; }
.root-tools #batch-expand {
  margin-left: auto;
  height: 32px;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 8px;
}
#batch-status { flex-basis: 100%; }
#batch-status:empty { display: none; }
.lookup-result {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  margin-top: 14px;
  box-shadow: 0 2px 10px rgba(23, 25, 45, .03);
}
.lookup-result > .empty {
  border: 0;
  padding: 28px 16px;
  background: transparent;
}
.lookup-list .lookup-row {
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  gap: 14px;
  padding: 10px 16px;
  min-height: 54px;
}
.lookup-list .lookup-term { overflow-wrap: anywhere; }
@media (max-width: 660px) {
  .lookup-hero { padding: 16px; }
  .lookup-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lookup-options label:last-child { grid-column: 1 / -1; }
  .lookup-result { padding: 14px 12px; }
  .lookup-list .lookup-row {
    grid-template-columns: 26px minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 10px 12px;
  }
}

.site-quality {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid #a5b4fc;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 600;
}
