@font-face {
  font-family: "Instrument Sans";
  src: url("/static/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --ink: #172743;
  --text: #293b53;
  --text-2: #42546b;
  --muted: #52657b;
  --line: #dce4ed;
  --border: #dce4ed;
  --border-strong: #c9d5e2;
  --canvas: #f3f6fa;
  --surface: #fff;
  --bg: #f3f6fa;
  --card: #fff;
  --accent: #2656bf;
  --accent-dark: #1b429a;
  --accent-soft: #edf3ff;
  --mint: #edf3ff;
  --shell-ink: #fbfcfe;
  --shell-muted: #4a5c73;
  --shell-line: #dce4ed;
  --shell-width: 214px;
  --app-header-height: 54px;
  --shadow: 0 1px 3px #1635550a;
}
body { display: block; margin: 0; min-width: 0; background: var(--canvas); color: var(--ink); font-family: var(--font); }
[hidden] { display: none !important; }
:where(button,a,input,select,textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip { position: fixed; z-index: 90; left: 12px; top: -100px; padding: 8px 12px; background: white; }
.skip:focus { top: 12px; }

.app-frame { display: grid; position: relative; grid-template-columns: var(--shell-width) minmax(0, 1fr); min-height: 100vh; }
.app-frame > main { min-width: 0; width: 100%; }
.shell-sidebar {
  position: sticky; top: 0; align-self: start; height: 100dvh; z-index: 35; overflow-y: auto;
  display: flex; flex-direction: column; padding: 25px 15px 16px;
  color: var(--shell-muted); background: var(--shell-ink); border-right: 1px solid var(--shell-line);
}
.shell-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); padding: 0 6px; margin-bottom: 30px; font-weight: 700; font-size: 1.2rem; white-space: nowrap; letter-spacing: -.04em; }
.shell-brand small { color: var(--muted); font-size: .82em; font-weight: 600; letter-spacing: 0; }
.shell-mark { flex: none; display: flex; align-items: flex-end; gap: 3px; padding: 8px; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); }
.shell-mark i { display: block; width: 4px; height: 7px; background: #fff; border-radius: 3px; transform: skew(-12deg); }
.shell-mark i:nth-child(2) { height: 12px; }
.shell-mark i:last-child { height: 17px; }
.shell-sidebar nav { display: grid; gap: 22px; }
.shell-nav-group { display: grid; gap: 4px; }
.shell-nav-group p { margin: 0 0 2px; padding: 0 9px; color: var(--muted); font-size: .7rem; font-weight: 650; letter-spacing: .075em; text-transform: uppercase; }
.shell-nav-group a { position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 9px; border-radius: 7px; color: inherit; font-size: .86rem; font-weight: 550; text-decoration: none; white-space: nowrap; }
.shell-nav-group a:hover { color: var(--ink); background: #f0f3f9; }
.shell-nav-group a[aria-current="page"] { color: var(--accent-dark); background: var(--accent-soft); font-weight: 700; }
.shell-nav-group a[aria-current="page"]::before { content: ""; position: absolute; inset: 8px auto 8px 0; width: 3px; border-radius: 2px; background: var(--accent); }
.shell-nav-group a [data-shell-icon] { display: inline-flex; flex: none; }
.shell-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 11px 8px 0; border-top: 1px solid var(--shell-line); min-height: 35px; font-size: .82rem; }
.shell-foot .health-dot { flex: none; }
.shell-foot .status-dot { display: inline-flex; }
.shell-foot .status-dot.ok span { box-shadow: none; }

.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 30; min-height: var(--app-header-height);
  padding: 8px clamp(14px, 3.3vw, 43px); background: #fff; border-bottom: 1px solid var(--line);
}
.shell-breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; font-size: .88rem; }
.shell-breadcrumb strong { color: var(--ink); font-size: .91rem; font-weight: 660; }
.shell-breadcrumb span::after { content: "/"; margin-left: 10px; color: #929db3; }
.header-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shell-status { display: inline-flex; align-items: center; min-height: 42px; padding: 6px 9px; color: var(--accent-dark); font-size: .82rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.shell-status:hover { background: var(--accent-soft); border-radius: 7px; }
.locale-toolbar { display: flex; align-items: center; gap: 6px; min-width: 0; }
.locale-picker { position: relative; min-width: 0; }
.locale-trigger {
  display: flex; align-items: center; gap: 8px; min-height: 43px; min-width: 0; max-width: 215px;
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px;
  background: #f9fafe; color: var(--ink); font: 600 .86rem/1.12 var(--font); cursor: pointer; text-align: left;
}
.locale-trigger:hover, .locale-trigger[aria-expanded="true"] { border-color: #a9bde1; background: var(--accent-soft); }
.locale-icon { display: grid; place-items: center; width: 25px; height: 26px; flex: none; border-radius: 5px; color: var(--accent-dark); background: var(--accent-soft); }
.locale-country .locale-trigger .locale-icon { font-size: 1.05rem; }
.locale-icon svg, .locale-chevron svg { width: 16px; height: 16px; }
.locale-label { display: grid; gap: 3px; min-width: 0; }
.locale-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .83rem; }
.locale-label small { color: var(--muted); font-size: .7rem; font-weight: 550; }
.locale-chevron { display: inline-flex; color: var(--muted); }
.locale-popup {
  position: absolute; z-index: 40; top: calc(100% + 8px); right: 0;
  width: min(340px, calc(100vw - 28px)); padding: 8px; border: 1px solid #cbd4e8;
  border-radius: 11px; background: #fff; box-shadow: 0 14px 36px #1b214329;
}
.locale-search { display: flex; align-items: center; gap: 7px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: #f8f9fe; }
.locale-search svg { flex: none; width: 17px; }
.locale-search input[type="search"] { border: 0; padding: 8px 0; height: 36px; width: 100%; min-width: 0; background: transparent; font-size: .9rem; box-shadow: none; }
.locale-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.locale-search input:focus-visible { outline: none; }
.locale-items { position: relative; display: grid; gap: 1px; margin: 6px 0 2px; max-height: min(320px, 50dvh); overflow: auto; overscroll-behavior: contain; }
.locale-items button {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 20px; align-items: center; gap: 7px;
  min-height: 43px; width: 100%; padding: 4px 6px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink); font: 550 .87rem/1.2 var(--font); text-align: left; cursor: pointer;
}
.locale-items button:hover, .locale-items button:focus-visible, .locale-items button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-dark); outline-offset: -2px; }
.locale-item-text { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.locale-item-text small, .locale-popup p, .locale-empty { color: var(--muted); font-size: .75rem; }
.locale-popup p { margin: 4px 6px 2px; }
.locale-empty { padding: 11px 5px; }
.locale-mark { display: grid; place-items: center; min-height: 25px; border-radius: 5px; font-size: .75rem; background: #edf0f9; }
.locale-country .locale-mark { font-size: 1.04rem; }
.provider-icon { display: inline-block; flex: none; width: 16px; height: 16px; object-fit: contain; vertical-align: middle; }

.workspace, .legacy-tool .content { max-width: 1520px; margin: 0 auto; padding: 32px clamp(14px, 3.3vw, 43px) 48px; }
.heading, .legacy-tool .page-head { margin: 0 0 21px; }
.heading h1, .legacy-tool .page-head h1 { color: var(--ink); font-size: clamp(1.9rem, 3.1vw, 2.65rem); letter-spacing: -.055em; font-weight: 700; margin: 0; }
.heading p, .legacy-tool .page-sub { color: var(--muted); margin: 7px 0 0; font-size: .94rem; }
.panel, .legacy-tool .card { border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.search-panel { padding: 17px 18px 12px; border-top: 1px solid var(--line); }
.search-panel #research-form { row-gap: 14px; }
.seed textarea, .search-field textarea { min-height: 45px; border-color: #cbd3e5; }
.button.primary, .legacy-tool .btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 1px 2px #38328b22; }
.button.primary:hover:not(:disabled), .legacy-tool .btn-primary:hover { background: var(--accent-dark); }
.button.secondary, .legacy-tool .btn-ghost { border-color: #d5dcec; color: var(--ink); background: #fff; }
.button.secondary:hover:not(:disabled), .legacy-tool .btn-ghost:hover { background: var(--accent-soft); }
.button, .legacy-tool .btn { border-radius: 8px; }
.expansion-panel .expansion-option { background: #f9fafe; border-color: var(--line); }
.expansion-panel .expansion-option:has(input:checked) { background: var(--accent-soft); border-color: #b4c8ee; }
.expansion-presets #google-alphabet { color: var(--accent-dark); background: var(--accent-soft); }
.legacy-tool .badge, .legacy-tool .chip { display: inline-flex; align-items: center; gap: 5px; }
.legacy-tool .chip { background: #f8f9fe; color: #384162; border-color: var(--line); }
.legacy-tool .chip.on { color: var(--accent-dark); background: var(--accent-soft); border-color: #b4c8ee; }
.legacy-tool table.data .provider-icon { margin-right: 4px; }
.source-name { display: flex; align-items: center; gap: 7px; }
.source-name .provider-icon { width: 18px; height: 18px; }

.metrics { gap: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: var(--shadow); }
.metric { background: transparent; border: 0; border-right: 1px solid var(--line); border-radius: 0; min-height: 72px; padding: 11px 16px; }
.metric:last-child { border-right: 0; }
.metric-icon { background: var(--accent-soft); color: var(--accent-dark); }
.metric strong { color: var(--ink); font-family: var(--font); font-variant-numeric: tabular-nums; font-size: 1.37rem; letter-spacing: -.035em; }
.results-heading { padding: 16px 18px 12px; }
.results-controls { padding-inline: 18px; }
.results-controls .tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--accent-dark); }
.results-panel thead, .legacy-tool table.data thead { background: #eef2f9; }
.results-panel tbody tr:hover, .legacy-tool table.data tbody tr:hover { background: #f2f6ff; }
.results-panel th, .legacy-tool table.data th { color: #404b69; }
.results-panel .alphabet-controls { background: #fcfcff; }
.results-panel .letter-picker { background: #fcfcff; }
.results-panel .letter-picker button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.legacy-tool .stat { border: 1px solid var(--line); box-shadow: var(--shadow); }
.legacy-tool .btn-dark { background: #233a5d; color: #fff; }
.results-panel, .legacy-tool #out { scroll-margin-top: calc(var(--app-header-height) + 12px); }

@media (max-width: 1100px) {
  :root { --shell-width: 207px; }
  .app-header { padding-inline: 18px; }
  .workspace, .legacy-tool .content { padding-inline: 18px; }
  .shell-breadcrumb span { display: none; }
}
@media (max-width: 820px) {
  :root { --app-header-height: 112px; }
  .app-frame { display: block; }
  .shell-sidebar {
    height: 56px; min-height: 56px; padding: 7px 12px; flex-direction: row; align-items: center;
    overflow: hidden; gap: 12px;
  }
  .shell-brand { margin: 0; padding: 0; }
  .shell-mark { width: 32px; height: 32px; padding: 7px; }
  .shell-sidebar nav, .shell-nav-group { display: flex; align-items: center; gap: 4px; }
  .shell-sidebar nav { overflow-x: auto; scrollbar-width: none; }
  .shell-nav-group p, .shell-foot { display: none; }
  .shell-nav-group a { min-height: 35px; }
  .app-header { top: 56px; min-height: 56px; }
}
@media (max-width: 600px) {
  .app-header { padding: 6px 12px; justify-content: stretch; }
  .shell-breadcrumb { display: none; }
  .header-actions { flex: 1; justify-content: space-between; }
  .locale-toolbar { flex: 1; }
  .locale-picker { flex: 1; max-width: 50%; }
  .locale-trigger { width: 100%; }
  .locale-country .locale-popup { left: 0; right: auto; }
  .locale-lang .locale-popup { left: auto; right: 0; }
  .shell-status { padding-inline: 5px; font-size: .73rem; }
  .workspace, .legacy-tool .content { padding: 19px 12px 35px; }
  .search-panel { padding: 12px; }
  .metrics { margin: 11px 0; }
  .metric { padding: 8px; min-height: 62px; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .metric strong { font-size: 1.15rem; }
  .results-heading, .results-controls { padding-inline: 12px; }
}

.search-panel .form-controls { align-self: end; }
.search-panel .form-controls .button { min-height: 45px; }
@media (max-width: 600px) {
  .locale-picker { position: static; }
  .locale-country .locale-popup, .locale-lang .locale-popup {
    inset: calc(100% + 4px) 12px auto;
    width: auto;
  }
}

.shell-mobile-menu { display: none; }
.shell-status { gap: 5px; }
.shell-status [data-shell-icon] { display: inline-flex; }
@media (max-width: 820px) {
  .shell-sidebar { overflow: visible; justify-content: space-between; }
  .shell-mobile-menu {
    display: inline-flex; align-items: center; gap: 6px; min-height: 36px;
    padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px;
    color: var(--ink); background: var(--surface); font: 650 .86rem var(--font);
  }
  .shell-mobile-menu span { display: inline-flex; }
  .shell-sidebar nav {
    display: none; position: absolute; top: 100%; left: 0; max-height: calc(100dvh - 56px);
    width: min(280px, 100%); overflow-y: auto; padding: 10px;
    background: var(--shell-ink); border: 1px solid var(--line); border-radius: 0 0 9px 0; box-shadow: 0 10px 20px #16273a24;
  }
  .shell-sidebar.is-open nav, .shell-sidebar .shell-nav-group { display: grid; }
  .shell-sidebar .shell-nav-group a { min-height: 40px; }
}
@media (max-width: 600px) {
  .shell-status { padding: 8px; }
  .shell-status-text { display: none; }
}

.result-source-icons { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.result-source-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; vertical-align: middle; }
.result-source-icon .provider-icon { width: 17px; height: 17px; }
.legacy-tool table.data .result-source-icon .provider-icon { margin-right: 0; }

/* Keep the research controls together as the results scroll below them. */
.query-bar {
  position: sticky; top: calc(var(--app-header-height) + 8px); z-index: 25;
  display: grid; grid-template-columns: minmax(145px, 1fr) auto auto;
  gap: 10px; align-items: end; padding: 11px 14px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow);
}
.query-bar .search-field { display: grid; gap: 4px; min-width: 0; }
.query-bar .search-field label { font-size: .825rem; font-weight: 650; }
.query-bar .search-field input, .query-bar .search-field textarea { width: 100%; min-height: 43px; }
.query-bar .search-field textarea { max-height: 130px; }
.legacy-tool .query-bar textarea { min-height: 57px; }
.query-bar .query-submit { min-height: 43px; margin: 0; }
.query-bar .locale-picker { flex: none; max-width: none; }
.query-bar .locale-trigger { min-height: 43px; }
.query-bar .locale-lang .locale-popup { right: 0; }
.search-panel .expansion-tools { margin-top: 3px; }
.legacy-tool .card:has(#pills) { margin-bottom: 14px; }
@media (max-width: 820px) {
  :root { --app-header-height: 100px; }
  .app-header { height: 44px; min-height: 44px; }
  .shell-status { min-height: 34px; }
}
@media (max-width: 650px) {
  .query-bar { grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 9px; }
  .query-bar .search-field { grid-column: 1 / -1; }
  .query-bar .locale-toolbar { align-items: stretch; }
  .query-bar .locale-picker { flex: 1; max-width: 50%; }
  .query-bar .locale-trigger { padding-inline: 5px; }
  .query-bar .locale-icon { width: 18px; }
}
@media (max-width: 600px) {
  .app-header .shell-breadcrumb { display: flex; }
  .app-header .header-actions { flex: none; }
  .query-bar .locale-country .locale-popup, .query-bar .locale-lang .locale-popup {
    inset: calc(100% + 4px) 8px auto;
  }
}

.results-panel { scroll-margin-top: calc(var(--app-header-height) + 106px); }
@media (max-width: 650px) {
  .query-bar .search-field { grid-column: 1; }
  .query-bar .query-submit { grid-column: 2; grid-row: 1; }
  .query-bar .locale-toolbar { grid-column: 1 / -1; grid-row: 2; }
  .results-panel { scroll-margin-top: calc(var(--app-header-height) + 154px); }
}
