:root {
  color-scheme: light;
  --navy: #20357e;
  --ink: #182348;
  --muted: #57637c;
  --subtle: #68738b;
  --blue: #3333cc;
  --periwinkle: #6666ff;
  --tint: #f0f0ff;
  --paper: #fff;
  --canvas: #f6f7fb;
  --border: #dce1ed;
  --line: #e8ebf3;
  --error: #a72d37;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-width: 280px; min-height: 100vh; font-size: 15px; }
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--periwinkle); outline-offset: 3px; }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link:focus { position: fixed; top: 8px; left: 8px; padding: 10px 16px; background: white; z-index: 20; }
.icon { width: 20px; height: 20px; display: inline-block; flex: 0 0 auto; vertical-align: middle; }
.muted { color: var(--muted); }
.hint-line { display: flex; align-items: center; gap: 6px; }
.hint-line > .field-help { margin-block: 0; }
.field-hint { display: inline-flex; align-items: center; vertical-align: middle; }
.hint-trigger { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--navy); font-size: 13px; font-weight: 700; line-height: 1; }
.hint-trigger::before { content: ""; position: absolute; width: 16px; height: 16px; border: 1px solid #7e8ba9; border-radius: 50%; }
.hint-trigger:hover, .hint-trigger[aria-expanded=true] { color: var(--blue); background: var(--tint); }
.hint-text { position: fixed; z-index: 30; width: max-content; max-width: min(340px, calc(100vw - 16px)); padding: 10px 13px; border: 1px solid var(--navy); border-radius: 7px; color: white; background: var(--ink); font-size: 13px; font-weight: 400; line-height: 1.45; text-align: left; overflow-wrap: anywhere; box-shadow: 0 4px 13px #17244724; }
.manual-copy-help { flex: 1 1 100%; color: var(--navy); font-size: 13px; }
@media (pointer: coarse) {
  .hint-trigger { width: 44px; height: 44px; }
}

/* Navigation */
.site-header { border-bottom: 1px solid var(--border); background: var(--paper); }
.header-inner, .page { width: min(100%, 1280px); margin-inline: auto; padding-inline: clamp(20px, 5.2vw, 72px); }
.header-inner { display: flex; align-items: center; min-height: 72px; gap: clamp(28px, 5vw, 70px); }
.brand-link { display: inline-flex; color: var(--ink); text-decoration: none; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 24px; letter-spacing: -1.3px; line-height: 1; font-weight: 700; }
.brand b { font-weight: 400; }
.brand img { display: block; }
.main-nav { display: flex; align-self: stretch; gap: 24px; }
.header-link { position: relative; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--muted); }
.header-link .icon { width: 16px; height: 16px; }
.header-link:hover, .header-link.current { color: var(--blue); }
.header-link.current::after { content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 3px; background: var(--blue); border-radius: 3px 3px 0 0; }
.account { display: flex; align-items: center; gap: 15px; margin-left: auto; min-width: 0; }
.account-badge { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 14px; color: var(--muted); }
.account-badge > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.account-badge .icon { width: 17px; height: 17px; }
.account form { display: flex; padding-left: 12px; border-left: 1px solid var(--border); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 7px; text-decoration: none; }
.icon-button .icon { width: 18px; height: 18px; }
.icon-button:hover { color: var(--blue); background: var(--tint); }

/* Shared components */
.page { padding-top: 42px; padding-bottom: 72px; }
.page-heading { margin-bottom: 26px; }
.page-heading h1 { color: var(--ink); font-size: clamp(34px, 3.4vw, 47px); line-height: 1.11; font-weight: 650; letter-spacing: -.055em; overflow-wrap: anywhere; }
.page-heading p { margin-top: 9px; max-width: 740px; font-size: 15px; line-height: 1.55; color: var(--muted); }
.section-heading { font-size: 21px; line-height: 1.22; font-weight: 650; letter-spacing: -.035em; }
.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 20px; border: 1px solid transparent; border-radius: 7px; text-decoration: none; font-weight: 600; font-size: 15px; line-height: 1.2; }
.button .icon { width: 18px; height: 18px; }
.button.primary { background: var(--blue); color: #fff; box-shadow: 0 1px 2px #20357e21; }
.button.primary:hover { background: #2929b1; }
.button.primary:active { background: #24248e; }
.button.primary:disabled, .button[aria-busy="true"] { opacity: .74; }
.button-labels, .copy-icons { display: inline-grid; place-items: center; }
.button-labels > span, .copy-icons > .icon { grid-area: 1 / 1; }
.button-labels .feedback-label { visibility: hidden; }
:is([aria-busy="true"], [data-copied="true"]) > .button-labels > :first-child { visibility: hidden; }
:is([aria-busy="true"], [data-copied="true"]) > .button-labels > .feedback-label { visibility: visible; }
.request-icon { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; }
.request-icon .icon { width: 100%; height: 100%; }
.button[aria-busy="true"] .request-icon .icon { visibility: hidden; }
.button[aria-busy="true"] .request-icon::after {
  content: ""; position: absolute; inset: 1px; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%;
}
.button.secondary { background: white; color: var(--navy); border-color: #cdd4e7; }
.run-review {
  position: fixed; inset: 0; width: min(550px, calc(100% - 24px)); max-height: min(88dvh, 800px);
  margin: auto; padding: 24px; overflow: auto; overscroll-behavior: contain;
  color: var(--ink); background: var(--paper); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 14px 60px #101c4b32;
}
.run-review::backdrop { background: #10193670; }
.run-review[open]:not(:modal) { z-index: 20; box-shadow: 0 0 0 160vmax #10193670; }
body:has(.run-review[open]:not(:modal)) :is(.site-header, .skip-link, .tool-page > :not(.run-review)) { visibility: hidden; }
.review-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.review-heading span:first-child { color: var(--muted); font-size: 13px; }
.review-heading h2 { margin: 2px 0 0; font-size: clamp(20px, 3vw, 24px); line-height: 1.15; }
.review-heading h2:focus { outline: none; }
.review-x { flex: 0 0 44px; height: 44px; }
.review-x span[aria-hidden] { font-size: 27px; font-weight: 400; }
.review-volume { display: flex; background: var(--tint); padding: 12px 16px; gap: 32px; margin: 20px 0 12px; border-radius: 8px; }
.review-volume span, .review-note, .review-settings dt, .review-settings small { color: var(--muted); font-size: 13px; }
.review-volume strong { display: block; font-size: 24px; line-height: 1.2; }
.review-settings { display: grid; grid-template-columns: minmax(92px, 32%) minmax(0, 1fr); gap: 10px 12px; margin: 18px 0; }
.review-settings dd { overflow-wrap: anywhere; }
.review-settings dd span, .review-settings small { display: block; }
.review-phrases span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; }
.review-request-error { margin-top: 12px; }
@media (max-width: 480px) {
  .run-review { padding: 16px; max-height: 92dvh; }
  .review-actions .button { flex-grow: 1; }
}
.button.secondary:hover { color: var(--blue); border-color: var(--periwinkle); background: #f9f9ff; }
.button.compact { min-height: 38px; padding-inline: 13px; gap: 7px; font-size: 13px; }
.button.compact .icon { width: 16px; height: 16px; }
.text-button { display: inline-flex; align-items: center; min-height: 36px; padding-inline: 6px; color: var(--blue); font-size: 13px; font-weight: 600; text-decoration: none; }
.text-button:hover { text-decoration: underline; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 19px; color: var(--muted); font-size: 13px; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--blue); text-decoration: underline; }
.crumbs .icon { width: 13px; height: 13px; color: #7785a3; }
.crumbs span { color: var(--ink); }
.alert, .worker-notice, .network-notice { display: flex; align-items: flex-start; gap: 9px; overflow-wrap: anywhere; padding: 12px 14px; border-radius: 7px; line-height: 1.45; font-size: 14px; }
.alert { color: #902c39; background: #fff2f3; border: 1px solid #f0cbd0; margin-bottom: 17px; }
.worker-notice, .network-notice { color: #674d1e; background: #fff9e9; border: 1px solid #ebdeb9; margin-bottom: 14px; }
.alert .icon, .worker-notice .icon { width: 17px; height: 17px; margin-top: 1px; }

/* Sign in */
.auth-page { background: #bdcafd; }
.auth-stage {
  min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(115deg, #183ac033, #ffffff0a 52%, #1d2d9a29), url("ribbons-indigo.webp") center center / cover no-repeat;
}
.auth-card {
  width: min(100%, 426px); padding: 40px 40px 41px; border: 1px solid #ffffffb3; border-radius: 18px;
  background: #fff; box-shadow: 0 24px 76px #17246b3d, 0 4px 15px #15266b14;
}
.agency-logo { display: block; width: 120px; aspect-ratio: 163 / 23; background: var(--navy); -webkit-mask: url("agency.svg") left center / contain no-repeat; mask: url("agency.svg") left center / contain no-repeat; }
.auth-card h1 { margin: 31px 0 25px; font-size: clamp(25px, 4.6vw, 31px); line-height: 1.13; letter-spacing: -.055em; }
.auth-form { display: grid; gap: 19px; }
.auth-form .field { gap: 8px; }
.auth-form input { height: 48px; background: #fafbfe; }
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 47px; }
.password-toggle { position: absolute; top: 3px; right: 4px; width: 41px; height: calc(100% - 6px); border: 0; border-radius: 5px; display: grid; place-items: center; background: transparent; color: var(--muted); }
.password-toggle:hover { color: var(--blue); background: var(--tint); }
.password-toggle .icon { width: 18px; height: 18px; }
.password-toggle .hide-eye, .password-toggle[aria-pressed="true"] .show-eye { display: none; }
.password-toggle[aria-pressed="true"] .hide-eye { display: inline; }
.sign-in { width: 100%; height: 48px; margin-top: 6px; }

/* Tool gallery */
.catalog-page { padding-top: 50px; }
.catalog-heading { margin-bottom: 24px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.tool-card { overflow: hidden; display: flex; flex-direction: column; color: var(--ink); text-decoration: none; background: white; border: 1px solid #d7dfee; border-radius: 13px; box-shadow: 0 2px 7px #20357e08; }
.tool-card:hover { border-color: #a7afd9; box-shadow: 0 5px 20px #20357e13; }
.tool-cover { height: clamp(115px, 12vw, 165px); display: flex; align-items: flex-end; padding: 19px 23px; background-size: cover; }
.positions-cover .tool-cover { background-color: var(--navy); background-position: center 54%; background-image: linear-gradient(100deg, #10216e66, #10276e11 70%), url("ribbons-blue.webp"); }
.competitors-cover .tool-cover { background-color: #8389fa; background-position: center 51%; background-image: linear-gradient(105deg, #2b29aa38, #5c63ff06 60%), url("ribbons-indigo.webp"); }
.wordstat-cover .tool-cover { position: relative; overflow: hidden; background: var(--navy); isolation: isolate; }
.wordstat-cover .tool-cover::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(115deg, #4326a6a6, #343aaa3b 70%), url("ribbons-blue.webp") 67% 91% / 140% auto; transform: rotate(180deg); }
.cover-icon { color: #fff; background: #1525746b; width: 45px; height: 45px; border: 1px solid #ffffff83; border-radius: 11px; display: grid; place-items: center; }
.cover-icon .icon { width: 24px; height: 24px; }
.competitors-cover .cover-icon { background: #282b9469; }
.tool-card-body { flex: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 23px 24px 25px; }
.tool-card-body h2 { font-size: clamp(20px, 1.85vw, 25px); font-weight: 650; line-height: 1.22; letter-spacing: -.04em; }
.tool-card-body p { max-width: 42ch; margin-top: 8px; color: var(--muted); line-height: 1.5; font-size: 14px; }
.open-tool { display: grid; align-items: center; justify-content: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; background: var(--tint); color: var(--blue); }
.open-tool .icon { width: 17px; height: 17px; }
.tool-card:hover .open-tool { color: white; background: var(--blue); }
@media (min-width: 701px) and (max-width: 1050px) {
  .tool-card-body { gap: 7px; padding-inline: 15px; }
  .tool-card-body h2 { font-size: 20px; }
  .open-tool { width: 25px; height: 25px; }
}

/* Job parameters */
.tool-page, .run-page { padding-top: 29px; }
.secondary-heading { display: flex; align-items: flex-start; gap: 17px; margin-bottom: 25px; }
.secondary-heading h1, .run-heading h1 { font-size: clamp(32px, 3vw, 40px); }
.heading-icon { flex: 0 0 auto; display: grid; place-items: center; width: 53px; height: 53px; margin-top: 1px; color: var(--blue); background: #e9eaff; border-radius: 12px; }
.heading-icon .icon { width: 27px; height: 27px; }
.settings-panel, .run-panel, .table-panel { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--paper); }
.form-columns { display: grid; grid-template-columns: 1.12fr 1fr; min-width: 0; }
.form-column { min-width: 0; display: flex; flex-direction: column; gap: 22px; padding: 26px clamp(20px, 2.45vw, 32px) 28px; }
.form-column + .form-column { border-left: 1px solid var(--line); }
.field { display: flex; flex-direction: column; min-width: 0; gap: 7px; }
.field label:not(.engine-option):not(.check-label):not(.choice-option), .field legend { font-size: 14px; font-weight: 600; color: var(--ink); }
.field input:not([type="radio"]):not([type="checkbox"]), .field textarea, .field select {
  display: block; width: 100%; min-width: 0; border: 1px solid #cdd4e5; border-radius: 7px; color: var(--ink);
  background: #fff; font-size: 15px; line-height: 1.4; padding: 11px 13px;
}
.field input:not([type="radio"]):not([type="checkbox"]), .field select { height: 45px; }
.auth-form .field input { min-height: 48px; background: #f9faff; }
.auth-form .field .password-field input { padding-right: 48px; }
.field input::placeholder, .field textarea::placeholder { color: #68758c; opacity: 1; }
.field textarea { min-height: 70px; resize: vertical; line-height: 1.52; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline: 2px solid var(--periwinkle); outline-offset: 1px; }
.field small, .field-help, .optional, .line-count { color: var(--muted); font-size: 12px; line-height: 1.45; }
.field-help { max-width: 56ch; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.line-count { font-variant-numeric: tabular-nums; }
.input-with-icon, .select-wrap { position: relative; }
.input-with-icon > .icon:first-child { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; pointer-events: none; color: var(--subtle); }
.field .input-with-icon input:not([type="checkbox"]), .field .input-with-icon select { padding-left: 39px; }
.select-wrap select { appearance: none; padding-right: 34px; cursor: pointer; }
.select-arrow { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; pointer-events: none; color: var(--muted); }
.checkboxes { display: flex; flex-wrap: wrap; gap: 7px 15px; }
.site-scope-frame { border: 0; padding: 0; margin: 0; min-width: 0; }
.site-options { padding-top: 2px; }
.site-options .field-help { width: 100%; }
.site-scope-fallback { margin-top: 6px; }
.site-scope-fallback .check-label { min-height: 28px; margin-right: 12px; }
.check-label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check-label input, .engine-option input { accent-color: var(--blue); width: 16px; height: 16px; margin: 0; flex: 0 0 auto; cursor: pointer; }
.check-label:has(input:disabled) { color: #8791a4; cursor: default; }
.minus-options { padding-top: 15px; border-top: 1px solid var(--line); }
.minus-options summary { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; list-style: none; font-size: 14px; color: var(--navy); font-weight: 600; }
.minus-options summary::-webkit-details-marker { display: none; }
.minus-options summary .icon { width: 17px; height: 17px; }
.minus-options summary .disclosure-arrow { width: 14px; height: 14px; }
.minus-options[open] .disclosure-arrow { transform: rotate(180deg); }
.minus-options > .field { margin-top: 12px; }
.choice-field { display: block; min-width: 0; margin: 0; border: 0; padding: 0; }
.choice-field legend { margin: 0 0 8px; padding: 0; }
.engine-options, .device-options, .depth-options { display: grid; gap: 7px; }
.engine-options, .device-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.depth-options { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.engine-option { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 14px; font-weight: 550; cursor: pointer; border: 1px solid #cdd4e5; border-radius: 7px; }
.engine-option:has(:checked) { border-color: #9797ed; background: #f7f7ff; }
.engine-option input { margin-left: auto; }
.engine-mark { display: block; width: 22px; height: 22px; object-fit: contain; flex: none; }
.choice-option { position: relative; cursor: pointer; min-width: 0; }
.choice-option > input { opacity: 0; position: absolute; width: 1px; height: 1px; }
.choice-option > span { min-height: 39px; display: flex; justify-content: center; align-items: center; gap: 7px; white-space: nowrap; background: white; border: 1px solid #cdd4e5; border-radius: 6px; color: var(--muted); font-size: 13px; }
.choice-option > span .icon { width: 16px; height: 16px; }
.choice-option input:checked + span { color: var(--blue); border-color: #9797ed; background: var(--tint); font-weight: 600; }
.choice-option input:focus-visible + span { outline: 3px solid var(--periwinkle); outline-offset: 2px; }
.choice-option:hover span, .engine-option:hover { border-color: #8b98ba; }
.search-column { gap: 17px; }
.search-column .section-heading { margin-bottom: 4px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px 21px; padding: 16px clamp(20px, 2.45vw, 32px); border-top: 1px solid var(--line); background: #fbfcff; }
.preview-summary { flex: 1; display: flex; align-items: flex-start; flex-direction: column; gap: 2px; font-variant-numeric: tabular-nums; }
.preview-summary strong { color: var(--navy); font-size: 14px; }
.preview-summary span { font-size: 12px; color: var(--muted); }
.preview-error strong, .preview-error span { color: var(--error); }
.launch { min-width: 182px; flex: none; }

/* History and result tables */
.history-section { margin-top: 42px; scroll-margin-top: 24px; }
.history-heading, .results-heading, .progress-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 15px; }
.history-heading, .results-heading { margin-bottom: 15px; }
.history-heading h2, .results-heading h2 { font-size: clamp(23px, 2.1vw, 28px); line-height: 1.14; font-weight: 650; letter-spacing: -.04em; }
.retention { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.retention .icon { width: 15px; height: 15px; }
.empty-panel { display: flex; align-items: center; justify-content: center; gap: 15px; min-height: 120px; border: 1px dashed #cbd3e4; border-radius: 12px; background: #ffffffa3; padding: 24px; }
.empty-icon { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 12px; background: #eaeefa; color: #5368a0; flex: none; }
.empty-icon .icon { width: 23px; height: 23px; }
.empty-panel h3 { font-size: 16px; font-weight: 600; letter-spacing: -.015em; }
.empty-panel p { margin-top: 3px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.history-table, .results-table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.history-table th, .results-table th { background: #f9faff; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.3; text-align: left; font-weight: 600; }
.history-table th, .history-table td, .results-table th, .results-table td { padding: 13px 16px; vertical-align: middle; overflow-wrap: anywhere; }
.history-table td, .results-table td { border-top: 1px solid var(--line); line-height: 1.42; }
.history-table tbody tr:first-child td, .results-table tbody tr:first-child td { border-top: 0; }
.history-table tbody tr:hover, .results-table tbody tr:hover { background: #fbfcff; }
.history-table th:nth-child(1) { width: 27%; }
.history-table th:nth-child(2) { width: 24%; }
.history-table th:nth-child(3) { width: 16%; }
.history-table th:nth-child(4) { width: 18%; }
.history-table th:nth-child(5) { width: 15%; }
.history-name a { color: var(--navy); font-weight: 650; text-decoration: none; }
.history-name a:hover { color: var(--blue); text-decoration: underline; }
.history-table small { display: block; margin-top: 3px; color: var(--subtle); font-size: 12px; line-height: 1.35; }
.history-date { font-variant-numeric: tabular-nums; }
.history-progress { display: flex; flex-wrap: wrap; gap: 1px 7px; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.history-progress strong { color: var(--navy); }
.history-status .row-progress { height: 4px; margin-block: 4px; }
.history-status .row-wait { color: var(--ink); }
.history-status .errors-number { color: var(--error); }
.history-table .file-col { padding-inline: 5px; text-align: center; }
.history-formats { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; }
.history-formats a { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 5px; background: var(--paper); color: var(--navy); font-size: 12px; line-height: 1; font-weight: 600; text-decoration: none; }
.history-formats a:hover { border-color: var(--periwinkle); color: var(--blue); background: var(--tint); }
.file-pending { color: #8792a6; }
.run-state { display: inline-flex; align-items: center; gap: 6px; width: max-content; max-width: 100%; padding: 4px 8px; border-radius: 5px; color: #4c5873; background: #edf0f6; font-weight: 600; font-size: 12px; line-height: 1.3; }
.state-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.state-running { color: #3633bc; background: #eeedff; }
.state-done { color: #1c704d; background: #e9f6ef; }
.state-paused, .state-partial { color: #805817; background: #fff4da; }
.state-error { color: #982e3e; background: #fcecf0; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); padding: 7px 13px; color: var(--muted); font-size: 13px; }

/* A single collection */
.run-heading p { overflow-wrap: anywhere; }
.run-panel { padding: 24px clamp(18px, 2.4vw, 31px); }
.progress-figures { margin-top: 21px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.progress-figures strong { font-size: 24px; line-height: 1; color: var(--ink); }
.progress-figures > span { color: var(--navy); font-weight: 600; }
.run-progress { display: block; appearance: none; width: 100%; height: 8px; border: 0; margin-top: 10px; overflow: hidden; border-radius: 8px; background: #e8ebfa; color: var(--blue); }
.run-progress::-webkit-progress-bar { background: #e8ebfa; }
.run-progress::-webkit-progress-value { background: linear-gradient(90deg, var(--periwinkle), var(--blue)); border-radius: 8px; }
.run-progress::-moz-progress-bar { background: var(--blue); border-radius: 8px; }
.run-times, .run-options-summary { display: flex; flex-wrap: wrap; gap: 4px 17px; color: var(--muted); font-size: 12px; }
.run-times { margin-top: 10px; }
.wait-reason, .report-note, .retake-intro > p { margin-top: 10px; color: var(--muted); font-size: 14px; }
.report-note { margin: 0 0 12px; }
.retake-actions, .retake-confirm { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.retake-confirm { justify-content: flex-end; }
.retake-intro .run-facts { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
.retake-table th, .retake-table td { text-align: left; }
.result-coverage, .result-outcome { display: block; color: var(--muted); font-weight: 400; }
.result-coverage { margin-top: 3px; font-size: 12px; }
.run-options-summary { margin-top: 15px; }
.errors-number, .row-error { color: var(--error); }
.row-error { display: block; }
.resume-line { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.resume-line p { font-size: 14px; color: var(--muted); }
.run-facts { display: grid; grid-template-columns: .7fr 1.5fr 1.1fr 1fr .8fr; column-gap: 16px; row-gap: 13px; margin: 21px 0 0; padding-top: 17px; border-top: 1px solid var(--line); }
.run-facts dt { margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.run-facts dd { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.results-section { margin-top: 30px; scroll-margin-top: 20px; }
.export-actions { display: flex; align-items: center; gap: 11px; }
.results-table th:nth-child(1) { width: 26%; }
.results-table th:nth-child(2) { width: 15%; }
.results-table th:nth-child(3) { width: 10%; }
.results-table th:nth-child(4) { width: 49%; }
.result-query { font-weight: 600; }
.result-title { display: block; margin-bottom: 3px; line-height: 1.35; }
.result-url { overflow-wrap: anywhere; color: var(--navy); text-decoration: underline; text-decoration-color: #b7c1df; text-underline-offset: 2px; }
.result-url:hover { color: var(--blue); }
.result-url .icon { width: 12px; height: 12px; margin-left: 4px; }
.rank { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; min-height: 24px; padding: 1px 5px; border-radius: 4px; background: var(--tint); color: var(--navy); font-variant-numeric: tabular-nums; font-weight: 600; }
.error-page { display: grid; align-items: center; min-height: 65vh; }
.error-panel { max-width: 500px; }
.error-code { color: var(--blue); font-weight: 700; }
.error-panel h1 { margin: 8px 0; font-size: clamp(28px, 3.8vw, 40px); letter-spacing: -.04em; line-height: 1.12; }
.error-panel p { margin-bottom: 20px; color: var(--muted); }

@media (max-width: 870px) {
  .header-inner, .page { padding-inline: 25px; }
  .header-inner { gap: 25px; }
  .main-nav { gap: 17px; }
  .form-column { padding-inline: 19px; }
  .history-table th, .history-table td, .results-table th, .results-table td { padding-inline: 11px; }
  .engine-option { gap: 5px; padding-inline: 7px; }
  .tool-card-body { padding: 20px; gap: 12px; }
}
@media (max-width: 700px) {
  .header-inner, .page { padding-inline: 18px; }
  .header-inner { min-height: 62px; gap: 17px; }
  .brand { gap: 7px; font-size: 21px; }
  .brand img { width: 30px; height: 30px; }
  .main-nav { margin-left: auto; gap: 5px; }
  .header-link { width: 34px; justify-content: center; }
  .header-link .icon { width: 19px; height: 19px; }
  .header-link span { position: absolute; overflow: hidden; width: 1px; height: 1px; clip: rect(0, 0, 0, 0); }
  .account { margin-left: 0; gap: 5px; }
  .account form { padding-left: 5px; }
  .account-badge { display: none; }
  .page { padding-top: 25px; padding-bottom: 42px; }
  .tool-grid { gap: 12px; }
  .tool-card-body { padding: 15px; }
  .tool-cover { height: 94px; padding: 11px 15px; }
  .cover-icon { width: 34px; height: 34px; border-radius: 8px; }
  .cover-icon .icon { width: 19px; height: 19px; }
  .open-tool { width: 26px; height: 26px; }
  .tool-card-body h2 { font-size: 18px; }
  .tool-card-body p { font-size: 13px; }
  .form-columns { grid-template-columns: 1fr; }
  .form-column { padding: 19px; gap: 17px; }
  .form-column + .form-column { border-left: 0; border-top: 1px solid var(--line); }
  .form-actions { padding: 14px 19px; }
  .secondary-heading { gap: 11px; }
  .heading-icon { width: 42px; height: 42px; border-radius: 9px; }
  .heading-icon .icon { width: 22px; height: 22px; }
  .history-section { margin-top: 30px; }
  .table-panel .history-table, .table-panel .history-table tbody, .table-panel .results-table, .table-panel .results-table tbody { display: block; }
  .history-table thead, .results-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .history-table tr, .results-table tr { padding: 13px 15px; display: grid; align-items: start; gap: 7px 12px; }
  .history-table tr { grid-template-columns: minmax(0, 1fr) max-content; }
  .history-table tr + tr, .results-table tr + tr { border-top: 1px solid var(--line); }
  .history-table td, .results-table td { display: block; padding: 0; border: 0; }
  .history-name { grid-column: 1; grid-row: 1; }
  .history-status { grid-column: 2; grid-row: 1; text-align: right; }
  .history-table tr:has(.history-progress) { grid-template-columns: minmax(0, 1fr); }
  .history-table tr:has(.history-progress) .history-status { grid-column: 1; grid-row: 4; text-align: left; }
  .history-table tr:has(.history-progress) td.file-col { grid-row: 5; }
  .history-params { grid-column: 1; grid-row: 2; font-size: 13px; }
  .history-date { grid-column: 1; grid-row: 3; font-size: 12px; color: var(--muted); }
  .history-table td.file-col { grid-column: 1 / -1; grid-row: 4; justify-self: stretch; padding: 3px 0 0; }
  .history-table td.file-col:has(.file-pending) { display: none; }
  .history-formats { justify-content: flex-start; gap: 8px; }
  .history-formats a { min-height: 44px; min-width: 58px; font-size: 13px; }
  .field textarea.queries-input { height: clamp(180px, 30vh, 255px); min-height: 135px; font-size: 16px; }
  .run-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .results-table tr { grid-template-columns: 1fr auto; }
  .result-query { grid-column: 1; grid-row: 1; }
  .result-engine { grid-column: 1; grid-row: 2; font-size: 12px; color: var(--muted); }
  .result-rank { grid-column: 2; grid-row: 1 / 3; text-align: right; }
  .result-rank::before { content: "Позиция "; color: var(--muted); font-size: 12px; }
  .result-page { grid-column: 1 / -1; font-size: 13px; }
}
@media (min-width: 521px) and (max-width: 760px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { display: grid; grid-template-columns: 118px minmax(0, 1fr); }
  .tool-cover { height: auto; min-height: 92px; align-items: center; justify-content: center; padding: 0; }
  .tool-card-body { align-items: center; padding: 15px 18px; }
  .tool-card-body h2 { font-size: 20px; }
  .tool-card-body p { max-width: none; margin-top: 4px; }
}
@media (max-width: 520px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { display: grid; grid-template-columns: 70px minmax(0, 1fr); }
  .tool-cover { height: auto; justify-content: center; align-items: center; padding: 0; }
  .tool-card-body { gap: 6px; padding: 16px 12px; }
  .tool-card-body p { margin-top: 5px; }
  .catalog-heading { margin-bottom: 18px; }
  .tool-card-body .open-tool { width: 20px; height: 24px; background: transparent; }
  .tool-card:hover .open-tool { color: var(--blue); }
  .history-heading, .results-heading { align-items: flex-start; }
  .retention { font-size: 12px; }
  .empty-panel { padding: 18px; min-height: 100px; gap: 11px; }
  .empty-icon { width: 37px; height: 37px; border-radius: 9px; }
  .empty-icon .icon { width: 20px; height: 20px; }
  .empty-panel p { font-size: 13px; }
  .crumbs { margin-bottom: 14px; }
  .secondary-heading h1, .run-heading h1 { font-size: 29px; }
  .secondary-heading p, .run-heading p { font-size: 14px; }
  .settings-panel, .run-panel, .table-panel { border-radius: 10px; }
  .form-column, .run-panel { padding: 17px 15px; }
  .form-actions { padding: 13px 15px; flex-direction: column; align-items: stretch; }
  .launch { width: 100%; }
  .run-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-stage { padding: 17px; }
  .auth-card { padding: 32px 25px; border-radius: 14px; }
}
@media (max-width: 370px) {
  .header-inner, .page { padding-inline: 12px; }
  .header-inner { gap: 8px; }
  .engine-options { grid-template-columns: 1fr; }
  .depth-options { gap: 3px; }
  .depth-options .choice-option > span { font-size: 12px; }
}
/* Additional collection settings and Wordstat */
.ws-regions-options summary, .collection-additional summary, .leaders-panel summary, .mcp-guide summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; color: var(--navy);
  cursor: pointer; font-size: 14px; font-weight: 600; list-style: none;
}
.ws-regions-options summary::-webkit-details-marker, .collection-additional summary::-webkit-details-marker,
.leaders-panel summary::-webkit-details-marker, .mcp-guide summary::-webkit-details-marker { display: none; }
.ws-regions-options .disclosure-arrow, .collection-additional .disclosure-arrow, .leaders-panel .disclosure-arrow, .mcp-guide .disclosure-arrow { width: 15px; height: 15px; }
details[open] > summary .disclosure-arrow { transform: rotate(180deg); }
.collection-additional { padding: 8px clamp(20px, 2.45vw, 32px); border-top: 1px solid var(--line); }
.collection-additional[open] { padding-bottom: 17px; }
.collection-additional summary > .icon:first-child { width: 17px; height: 17px; }
.collection-additional .field-help { margin: 3px 0 10px; max-width: none; }
.profile-row { border: 0; border-top: 1px solid var(--line); margin: 12px 0 0; padding: 8px 0 0; }
.profile-row legend { font-size: 13px; color: var(--muted); padding: 0 8px 0 0; }
.profile-fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.check-list { display: grid; justify-items: start; gap: 5px; }
.check-list .check-label { min-height: 32px; }
.wordstat-form:not(:has(input[name="mode"][value="phrases"]:checked)) [data-ws-only="phrases"],
.wordstat-form:not(:has(input[name="mode"][value="seasonality"]:checked)) [data-ws-only="seasonality"],
.wordstat-form:not(:has(input[name="mode"][value="frequency"]:checked)) [data-ws-only="frequency"] { display: none; }
.wordstat-mode { margin: 0; padding: 16px clamp(20px,2.45vw,32px) 18px; border-bottom: 1px solid var(--line); background: #fbfcff; }
.wordstat-mode legend { float: left; width: 100%; margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.mode-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); clear: both; gap: 7px; max-width: 640px; }
.mode-options .choice-option > span { min-height: 44px; padding: 6px 12px; font-size: 14px; text-align: center; white-space: normal; }
@supports selector(:has(input:checked)) {
  .wordstat-mode .mode-options {
    position: relative; isolation: isolate; gap: 0; padding: 3px; border: 1px solid var(--border);
    border-radius: 10px; background: #edf0f8;
  }
  .mode-options::before {
    content: ""; position: absolute; inset: 3px auto 3px 3px; width: calc((100% - 6px) / 3);
    border: 1px solid #8088c2; border-radius: 7px; background: var(--paper);
    box-shadow: 0 1px 3px #20357e1a; pointer-events: none;
  }
  .mode-options:has(input[value="phrases"]:checked)::before { transform: translateX(100%); }
  .mode-options:has(input[value="seasonality"]:checked)::before { transform: translateX(200%); }
  .mode-options .choice-option > span,
  .mode-options .choice-option input:checked + span { position: relative; border-color: transparent; background: transparent; }
  .mode-options .choice-option:hover > span { color: var(--blue); }
  .mode-options .choice-option input:focus-visible + span { outline-offset: -3px; }
}
.frequency-options, .ws-dates { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.frequency-option { display: flex; align-items: center; gap: 8px; min-height: 43px; padding: 7px 9px; border: 1px solid #cdd4e5; border-radius: 6px; cursor: pointer; }
.frequency-option:has(:checked) { background: var(--tint); border-color: #9797ed; }
.frequency-option input { accent-color: var(--blue); width: 16px; height: 16px; margin: 0; flex: none; }
.frequency-option span { font-size: 13px; line-height: 1.3; }
.frequency-option small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
.date-hint { margin-top: 7px; }
.ws-lookback { margin-top: 7px; }
.ws-regions-options { margin-top: -12px; }
.ws-regions-options summary { font-size: 13px; }
.additional-regions { display: flex; flex-wrap: wrap; gap: 4px 13px; }
.additional-regions .check-label, .ws-checkbox { min-height: 36px; }
.minus-action { margin-top: 11px; }
.row-location, .minus-match { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 3px; }
.wordstat-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; font-size: 14px; }
.wordstat-table th, .wordstat-table td { padding: 12px 16px; overflow-wrap: anywhere; vertical-align: middle; }
.wordstat-table th { color: var(--muted); background: #f9faff; font-size: 12px; font-weight: 600; }
.wordstat-table td { border-top: 1px solid var(--line); }
.ws-count { font-variant-numeric: tabular-nums; }
.leaders-panel { background: var(--paper); border: 1px solid var(--border); margin-top: 15px; border-radius: 9px; padding: 8px 17px; }
.leaders-panel > .field-help { margin: 3px 0 13px; }
.leaders-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; padding-bottom: 10px; }
.leaders-grid h3 { font-size: 14px; }
.leaders-grid ol { list-style: none; margin: 3px 0 0; padding: 0; }
.leaders-grid li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.leaders-grid li span { overflow-wrap: anywhere; }

/* MCP connection and token management */
.mcp-flow { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 0 0 19px; padding: 0; list-style: none; border: 1px solid #d6dcf3; border-radius: 10px; background: #eff1fe; }
.mcp-flow li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; }
.mcp-flow li > div { display: grid; gap: 2px; }
.mcp-flow strong { color: var(--navy); font-size: 15px; }
.mcp-flow span { color: var(--muted); font-size: 13px; }
.mcp-flow .icon { color: var(--blue); width: 16px; height: 16px; }
.mcp-columns { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.15fr); gap: 16px; align-items: start; }
.mcp-panel { min-width: 0; background: var(--paper); border: 1px solid var(--border); border-radius: 12px; padding: clamp(18px,2.1vw,29px); }
.panel-intro, .mcp-guide p { font-size: 14px; line-height: 1.5; margin-top: 9px; color: var(--muted); }
.token-form { display: grid; gap: 12px; justify-items: start; margin-top: 17px; }
.token-form .field { width: 100%; }
.token-list { display: grid; list-style: none; margin: 20px 0 0; padding: 0; }
.token-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding: 11px 0; }
.token-list strong, .token-list small { display: block; overflow-wrap: anywhere; }
.token-list small, .mcp-empty, .token-note { color: var(--muted); font-size: 12px; }
.token-list small { margin-top: 3px; }
.mcp-empty { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }
.button.revoke { color: var(--error); }
.one-time-token { margin-top: 15px; padding: 11px; border: 1px solid #cfcff0; border-radius: 7px; background: #f6f6ff; }
.one-time-token label, .endpoint-field > span { font-size: 14px; font-weight: 600; display: block; margin-bottom: 5px; }
.one-time-token input { width: 100%; color: var(--ink); font-family: Consolas, monospace; font-size: 13px; height: 42px; padding-inline: 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--paper); }
.token-note { display: flex; justify-content: space-between; gap: 5px; align-items: center; }
.copy-button { gap: 5px; white-space: nowrap; }
.copy-icons .icon { width: 16px; height: 16px; }
.copy-icons .copy-check, .copy-button[data-copied] .copy-icons > :first-child { opacity: 0; }
.copy-button[data-copied] { color: #216246; }
.copy-button[data-copied] .copy-check { opacity: 1; }
@media (pointer: coarse) {
  .copy-button { min-height: 44px; }
}
.endpoint-field { margin: 14px 0 6px; }
.mcp-guide { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 7px; }
.code-box, .mcp-panel pre { border: 1px solid var(--border); border-radius: 6px; background: #f7f8fd; padding: 8px 10px; }
.code-box { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; }
.code-box code { flex: 1 1 14ch; min-width: 0; }
.mcp-panel code { color: var(--navy); font-family: Consolas, "Courier New", monospace; font-size: 13px; overflow-wrap: anywhere; }
.mcp-panel pre { margin: 6px 0 11px; white-space: pre-wrap; }
.mcp-guide .code-box { margin-top: 6px; }
button.text-button { border: 0; background: transparent; cursor: pointer; }
.mcp-sequence { margin-top: 16px; }
.mcp-sequence ol { margin: 12px 0 0; padding-left: 19px; }
.mcp-sequence li { padding-left: 4px; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.mcp-sequence li strong { color: var(--ink); }
@media (max-width: 700px) {
  .mcp-columns, .leaders-grid { grid-template-columns: 1fr; }
  .header-link[href="/mcp"] { width: auto; gap: 5px; padding-inline: 5px; }
  .header-link[href="/mcp"] span { position: static; width: auto; height: auto; clip: auto; }
  .mcp-flow li { padding: 11px; }
  .wordstat-table, .wordstat-table tbody { display: block; }
  .wordstat-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .wordstat-table tr { display: grid; padding: 9px 14px; gap: 3px; }
  .wordstat-table tr + tr { border-top: 1px solid var(--line); }
  .wordstat-table td { display: grid; grid-template-columns: minmax(82px,30%) 1fr; gap: 0 8px; padding: 2px 0; border: 0; }
  .wordstat-table td > small, .wordstat-table td > .row-error { grid-column: 2; }
  .wordstat-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 400; }
  .profile-fields { gap: 8px; }
}
@media (max-width: 520px) {
  .mcp-panel .code-box { display: grid; grid-template-columns: minmax(0, 1fr); }
  .code-box .copy-button { justify-self: end; }
  .token-note { flex-wrap: wrap; }
  .wordstat-mode { padding-inline: 15px; }
  .mode-options { gap: 4px; }
  .mode-options .choice-option > span { min-height: 46px; font-size: 13px; padding-inline: 5px; }
  .collection-additional { padding-inline: 15px; }
  .profile-fields { grid-template-columns: 1fr; }
  .profile-row { margin-top: 12px; }
  .mcp-flow { grid-template-columns: 1fr; }
  .mcp-flow li { padding: 9px 13px; }
  .mcp-flow li + li { border-top: 1px solid #d6dcf3; }
  .mcp-flow .icon { transform: rotate(90deg); }
  .mcp-guide summary, .ws-regions-options summary, .collection-additional summary, .leaders-panel summary, .check-list .check-label { min-height: 44px; }
}
@media (max-width: 370px) {
  .header-inner { gap: 5px; padding-inline: 9px; }
  .header-inner .brand { font-size: 19px; }
  .header-inner .brand img { width: 27px; height: 27px; }
  .header-link[href="/mcp"] { min-width: 36px; padding-inline: 0; }
  .header-link[href="/mcp"] .icon { display: none; }
}
@media (forced-colors: active) {
  .agency-logo { background: CanvasText; forced-color-adjust: none; }
  .state-dot { border: 1px solid CanvasText; }
  .choice-option input:checked + span { outline: 2px solid Highlight; }
  .mode-options::before { border-color: Highlight; }
}
@media (prefers-reduced-motion: no-preference) {
  .tool-card, .open-tool, .button, .header-link, .icon-button { transition: background-color .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease; }
  .mode-options::before { transition: transform .18s cubic-bezier(.2,.75,.25,1); }
  .button[aria-busy="true"] .request-icon::after { animation: request-spin .8s linear infinite; }
  .run-review:modal { animation: review-appear .16s ease-out; }
  .copy-icons .icon { transition: opacity .12s ease, transform .15s ease-out; }
  .copy-icons .copy-check { transform: scale(.72); }
  .copy-button[data-copied] .copy-check { transform: scale(1); }
  .copy-button[data-copied] .copy-icons > :first-child { transform: scale(.82); }
}
@keyframes request-spin { to { transform: rotate(1turn); } }
@keyframes review-appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
