/* ==========================================================================
   SEO Keyword Hunter — GitHub-dark analytical UI
   ========================================================================== */

/* --------------------------------------------------------------------------
   Typeface — Plus Jakarta Sans, self-hosted
   Served from /fonts so the strict CSP (style-src 'self', no third-party
   font-src) keeps working and there is no render-blocking CDN request.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/plus-jakarta-sans-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/plus-jakarta-sans-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("./fonts/plus-jakarta-sans-latin-800-normal.woff2") format("woff2");
}

:root {
  /* Surfaces */
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --surface: #161b22;
  --surface-2: #1c2128;
  --surface-3: #21262d;
  --border: #21262d;
  --border-strong: #30363d;

  /* Text */
  --text: #e6edf3;
  --text-dim: #c9d1d9;
  --muted: #8b949e;

  /* Accents */
  --cyan: #58a6ff;
  --cyan-soft: rgba(88, 166, 255, 0.15);
  --violet: #bc8cff;
  --violet-soft: rgba(188, 140, 255, 0.15);
  --emerald: #2ea44f;
  --emerald-soft: rgba(46, 164, 79, 0.16);
  --blue: #58a6ff;
  --blue-soft: rgba(88, 166, 255, 0.15);
  --amber: #d29922;
  --amber-soft: rgba(210, 153, 34, 0.16);
  --red: #f85149;
  --red-soft: rgba(248, 81, 73, 0.15);

  /* Shape + motion */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 18px 45px -22px rgba(1, 4, 9, 0.85);
  --ring: 0 0 0 3px rgba(88, 166, 255, 0.3);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);

  /* Surfaces that need explicit light-mode counterparts */
  --header-bg: rgba(13, 17, 23, 0.72);
  --footer-bg: rgba(13, 17, 23, 0.6);
  --panel-surface-bg: linear-gradient(180deg, rgba(22, 27, 34, 0.92), rgba(13, 17, 23, 0.94));
  --surface-inset: rgba(13, 17, 23, 0.55);
  --metric-bg: linear-gradient(180deg, rgba(22, 27, 34, 0.94), rgba(13, 17, 23, 0.92));
  --table-head-bg: #161b22;
  --drawer-head-bg: rgba(22, 27, 34, 0.96);

  /* Form controls — must stay legible on both themes */
  --input-bg: rgba(13, 17, 23, 0.85);
  --input-bg-focus: rgba(13, 17, 23, 0.98);
  --input-border-hover: #484f58;
  --option-bg: #161b22;
  --placeholder: #6e7681;

  /* Semantic text tones */
  --tone-info: #79c0ff;
  --tone-info-border: rgba(88, 166, 255, 0.32);
  --tone-blue: #79c0ff;
  --tone-violet: #d2a8ff;
  --tone-success: #3fb950;
  --tone-success-strong: #56d364;
  --tone-success-border: rgba(63, 185, 80, 0.35);
  --tone-warn: #d29922;
  --tone-danger: #ff7b72;
  --tone-neutral: #c9d1d9;
  --faint: #6e7681;

  /* Toasts */
  --toast-success-bg: #12261e;
  --toast-success-fg: #7ee787;
  --toast-success-border: rgba(63, 185, 80, 0.42);
  --toast-error-bg: #2d1416;
  --toast-error-fg: #ffa198;
  --toast-error-border: rgba(248, 81, 73, 0.42);

  --panel-bg: linear-gradient(180deg, #161b22, #0d1117 60%);
  --panel-foot-bg: rgba(22, 27, 34, 0.74);
  --drawer-glass: rgba(22, 27, 34, 0.82);
  --menu-bg: rgba(22, 27, 34, 0.98);
  --gauge-track: rgba(139, 148, 158, 0.22);
  --orb-opacity: 0.4;

  --font-sans: "Plus Jakarta Sans", "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;

  color-scheme: dark;
}


/* --------------------------------------------------------------------------
   Light theme — same tokens, retuned for light surfaces
   -------------------------------------------------------------------------- */

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f6f8fa;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --surface-3: #eaeef2;
  --border: rgba(31, 35, 40, 0.12);
  --border-strong: rgba(31, 35, 40, 0.24);

  --text: #1f2328;
  --text-dim: #424a53;
  --muted: #656d76;

  --cyan: #0969da;
  --cyan-soft: rgba(9, 105, 218, 0.1);
  --violet: #8250df;
  --violet-soft: rgba(130, 80, 223, 0.1);
  --emerald: #1a7f37;
  --emerald-soft: rgba(26, 127, 55, 0.1);
  --blue: #0969da;
  --blue-soft: rgba(9, 105, 218, 0.1);
  --amber: #9a6700;
  --amber-soft: rgba(154, 103, 0, 0.12);
  --red: #cf222e;
  --red-soft: rgba(207, 34, 46, 0.1);

  --shadow: 0 18px 45px -24px rgba(31, 35, 40, 0.22);
  --ring: 0 0 0 3px rgba(9, 105, 218, 0.22);

  /* Surfaces */
  --header-bg: rgba(255, 255, 255, 0.84);
  --footer-bg: rgba(255, 255, 255, 0.86);
  --panel-surface-bg: linear-gradient(180deg, #ffffff, #fbfcfd);
  --surface-inset: #f6f8fa;
  --metric-bg: linear-gradient(180deg, #ffffff, #fafbfc);
  --table-head-bg: #f6f8fa;
  --drawer-head-bg: rgba(255, 255, 255, 0.97);

  /* Form controls */
  --input-bg: #ffffff;
  --input-bg-focus: #ffffff;
  --input-border-hover: rgba(31, 35, 40, 0.38);
  --option-bg: #ffffff;
  --placeholder: #8c959f;

  /* Semantic text tones */
  --tone-info: #0550ae;
  --tone-info-border: rgba(9, 105, 218, 0.32);
  --tone-blue: #0969da;
  --tone-violet: #6639ba;
  --tone-success: #1a7f37;
  --tone-success-strong: #1a7f37;
  --tone-success-border: rgba(26, 127, 55, 0.34);
  --tone-warn: #7d4e00;
  --tone-danger: #a40e26;
  --tone-neutral: #424a53;
  --faint: #6e7781;

  /* Toasts */
  --toast-success-bg: #dafbe1;
  --toast-success-fg: #116329;
  --toast-success-border: rgba(26, 127, 55, 0.4);
  --toast-error-bg: #ffebe9;
  --toast-error-fg: #a40e26;
  --toast-error-border: rgba(207, 34, 46, 0.4);

  --panel-bg: linear-gradient(180deg, #ffffff, #f6f8fa);
  --panel-foot-bg: rgba(255, 255, 255, 0.78);
  --drawer-glass: rgba(255, 255, 255, 0.86);
  --menu-bg: rgba(255, 255, 255, 0.99);
  --gauge-track: rgba(31, 35, 40, 0.14);
  --orb-opacity: 0.16;
}

:root[data-theme="light"] body {
  background: var(--bg);
}

/* Header, footer and panels take their surfaces from the tokens above, so
   only the light-only depth cue needs an override. */
:root[data-theme="light"] .panel {
  box-shadow: 0 1px 2px rgba(31, 35, 40, 0.06), 0 12px 28px -22px rgba(31, 35, 40, 0.35);
}

:root[data-theme="light"] .brand-mark {
  border-color: rgba(9, 105, 218, 0.24);
  background: linear-gradient(150deg, rgba(9, 105, 218, 0.1), rgba(130, 80, 223, 0.1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"] .status-stack {
  background: var(--surface-inset);
}

:root[data-theme="light"] .toast {
  box-shadow: 0 18px 44px -18px rgba(31, 35, 40, 0.35);
}

:root[data-theme="light"] .drawer-backdrop {
  background: rgba(31, 35, 40, 0.42);
}

:root[data-theme="light"] .orb {
  opacity: var(--orb-opacity);
}

:root[data-theme="light"] .grid-overlay {
  opacity: 0.5;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The hidden attribute must always win over layout display values. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: var(--cyan);
}

::selection {
  background: rgba(88, 166, 255, 0.28);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

.shell {
  width: min(1440px, 100% - 48px);
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--cyan);
  color: #041018;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 12px;
}

/* --------------------------------------------------------------------------
   Ambient background
   -------------------------------------------------------------------------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.4;
}

.orb--cyan {
  width: 620px;
  height: 620px;
  top: -300px;
  left: -140px;
  background: radial-gradient(circle, rgba(88, 166, 255, 0.55), transparent 68%);
}

.orb--violet {
  width: 560px;
  height: 560px;
  top: -220px;
  right: -180px;
  background: radial-gradient(circle, rgba(188, 140, 255, 0.42), transparent 68%);
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 15%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 15%, transparent 75%);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: relative;
  z-index: 5;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding-block: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  border: 1px solid rgba(88, 166, 255, 0.28);
  background: linear-gradient(150deg, rgba(88, 166, 255, 0.16), rgba(188, 140, 255, 0.14));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.brand-tag {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: var(--surface);
  white-space: nowrap;
}

.pill--live {
  border-color: var(--tone-success-border);
  background: var(--emerald-soft);
  color: var(--tone-success-strong);
}

.pill--ghost {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.6);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.55);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(63, 185, 80, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(63, 185, 80, 0);
  }
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-block: 28px 56px;
}

.panel {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-surface-bg);
  box-shadow: var(--shadow);
}

/* --------------------------------------------------------------------------
   Query panel
   -------------------------------------------------------------------------- */

.query-panel {
  padding: 26px 26px 20px;
  overflow: hidden;
}

.query-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88, 166, 255, 0.55), transparent);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 6px;
}

h1 {
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.18;
}

.lede {
  margin-top: 8px;
  max-width: 62ch;
  color: var(--muted);
  font-size: 14px;
}

.status-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-inset);
  flex: 0 0 auto;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.tick {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--emerald-soft);
  border: 1px solid rgba(63, 185, 80, 0.4);
  position: relative;
}

.tick::after {
  content: "";
  position: absolute;
  inset: 3.5px;
  border-radius: 50%;
  background: var(--emerald);
}

/* Form */

.hunt-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px 220px auto;
  gap: 14px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.req {
  color: var(--cyan);
}

.field--submit {
  justify-content: flex-end;
}

.input-wrap,
.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.input-wrap input,
.search-wrap input,
.select-wrap select {
  width: 100%;
  height: 46px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

.input-wrap input {
  padding: 0 14px 0 40px;
  font-size: 14.5px;
}

.input-wrap input::placeholder,
.search-wrap input::placeholder {
  color: var(--placeholder);
}

.input-wrap input:hover,
.select-wrap select:hover,
.search-wrap input:hover {
  border-color: var(--input-border-hover);
}

.input-wrap input:focus,
.select-wrap select:focus,
.search-wrap input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: var(--ring);
  background: var(--input-bg-focus);
}

.input-wrap input.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.18);
}

.input-wrap input[readonly] {
  opacity: 0.65;
  cursor: progress;
}

.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 36px 0 13px;
  font-size: 14px;
  cursor: pointer;
}

.select-wrap select option {
  background: var(--option-bg);
  color: var(--text);
}

.select-caret {
  position: absolute;
  right: 13px;
  width: 11px;
  height: 8px;
  color: var(--muted);
  pointer-events: none;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.field-error {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--red);
}

/* Buttons */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease),
    box-shadow 0.18s var(--ease), opacity 0.18s var(--ease);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn--primary {
  padding-inline: 22px;
  color: #ffffff;
  background: linear-gradient(135deg, #58a6ff, #388bfd);
  box-shadow: 0 12px 30px -12px rgba(56, 139, 253, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn--primary:hover:not(:disabled) {
  box-shadow: 0 16px 38px -12px rgba(56, 139, 253, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn--primary:disabled {
  cursor: progress;
  opacity: 0.85;
}

.btn-arrow {
  width: 15px;
  height: 15px;
  transition: transform 0.2s var(--ease);
}

.btn--primary:hover:not(:disabled) .btn-arrow {
  transform: translateX(3px);
}

.btn--ghost {
  height: 40px;
  padding-inline: 14px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: rgba(88, 166, 255, 0.5);
  background: var(--surface-3);
}

.btn--ghost svg {
  width: 15px;
  height: 15px;
}

.btn--sm {
  height: 34px;
  font-size: 12.5px;
}

.btn.is-loading .btn-label {
  opacity: 0.75;
}

.btn.is-loading .btn-arrow {
  display: none;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(4, 19, 26, 0.28);
  border-top-color: #04131a;
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .spinner {
  display: block;
}

.spinner--lg {
  display: block;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-width: 3px;
  border-color: rgba(88, 166, 255, 0.2);
  border-top-color: var(--cyan);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error banner */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.09);
}

.banner-icon {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(248, 81, 73, 0.2);
  color: var(--tone-danger);
  font-weight: 800;
  font-size: 13px;
}

.banner-body {
  min-width: 0;
  flex: 1;
}

.banner-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tone-danger);
}

.banner-detail {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--red);
  overflow-wrap: anywhere;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--red);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(248, 81, 73, 0.16);
  border-color: rgba(248, 81, 73, 0.3);
}

/* Sample chips */

.samples {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.samples-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.06);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease),
    transform 0.15s var(--ease);
}

.chip:hover {
  color: var(--cyan);
  border-color: rgba(88, 166, 255, 0.45);
  background: var(--cyan-soft);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Empty + loading states
   -------------------------------------------------------------------------- */

.empty-state {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 34px;
  align-items: center;
  padding: 38px 32px;
}

.empty-graphic {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  height: 150px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(88, 166, 255, 0.05), transparent 70%),
    repeating-linear-gradient(0deg, transparent, transparent 29px, rgba(148, 163, 184, 0.1) 30px);
}

.empty-graphic .bar {
  width: 18px;
  height: 50%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, rgba(88, 166, 255, 0.9), rgba(88, 166, 255, 0.12));
  animation: rise 0.9s var(--ease) both;
}

.empty-graphic .bar:nth-child(even) {
  background: linear-gradient(180deg, rgba(188, 140, 255, 0.9), rgba(188, 140, 255, 0.1));
}

.empty-graphic .bar--1 {
  height: 38%;
}
.empty-graphic .bar--2 {
  height: 64%;
}
.empty-graphic .bar--3 {
  height: 48%;
}
.empty-graphic .bar--4 {
  height: 82%;
}
.empty-graphic .bar--5 {
  height: 58%;
}
.empty-graphic .bar--6 {
  height: 94%;
}

.empty-graphic .bar:nth-child(2) {
  animation-delay: 0.06s;
}
.empty-graphic .bar:nth-child(3) {
  animation-delay: 0.12s;
}
.empty-graphic .bar:nth-child(4) {
  animation-delay: 0.18s;
}
.empty-graphic .bar:nth-child(5) {
  animation-delay: 0.24s;
}
.empty-graphic .bar:nth-child(6) {
  animation-delay: 0.3s;
}

@keyframes rise {
  from {
    transform: scaleY(0);
    transform-origin: bottom;
    opacity: 0;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

.empty-copy h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.empty-copy p {
  color: var(--muted);
  font-size: 14px;
  max-width: 68ch;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 14px;
}

.feature-list li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-dim);
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
}

.loading-panel {
  padding: 26px;
}

.loading-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.loading-head > div {
  flex: 1;
  min-width: 0;
}

.loading-title {
  font-size: 14.5px;
  font-weight: 700;
}

.loading-status {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.08), rgba(148, 163, 184, 0.18), rgba(148, 163, 184, 0.08));
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 150% 0;
  }
  to {
    background-position: -50% 0;
  }
}

.skeleton-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
}

.skeleton--card {
  height: 96px;
  border-radius: var(--radius);
}

.skeleton-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.skeleton--line {
  height: 12px;
}

.skeleton--w92 {
  width: 92%;
}
.skeleton--w78 {
  width: 78%;
}
.skeleton--w86 {
  width: 86%;
}
.skeleton--w64 {
  width: 64%;
}
.skeleton--w74 {
  width: 74%;
}

/* --------------------------------------------------------------------------
   Report head
   -------------------------------------------------------------------------- */

.results {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.report-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.report-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  text-transform: capitalize;
}

.report-market {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--tone-info-border);
  background: var(--cyan-soft);
  color: var(--tone-info);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.report-meta {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Metrics
   -------------------------------------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--metric-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent, var(--cyan)), transparent);
  opacity: 0.65;
}

.metric-card[data-tone="opportunity"] {
  --accent: var(--emerald);
}

.metric-card[data-tone="competition"] {
  --accent: var(--amber);
}

.metric-card[data-tone="total"] {
  --accent: var(--cyan);
}

.intent-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px 18px;
}

.intent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.intent-hint {
  font-size: 11.5px;
  color: var(--muted);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.metric-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--accent, var(--cyan));
}

.metric-icon svg {
  width: 17px;
  height: 17px;
}

.metric-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.meter {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent, var(--cyan)), rgba(255, 255, 255, 0.75));
  transition: width 0.9s var(--ease);
}

.metric-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.intent-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
  gap: 2px;
}

.intent-seg {
  height: 100%;
  width: 0;
  transition: width 0.9s var(--ease);
}

.intent-seg--informational {
  background: linear-gradient(90deg, #1f6feb, #58a6ff);
}

.intent-seg--commercial {
  background: linear-gradient(90deg, #8957e5, #bc8cff);
}

.intent-seg--transactional {
  background: linear-gradient(90deg, #238636, #3fb950);
}

.intent-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 12px;
  color: var(--text-dim);
}

.intent-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.intent-legend b {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-dot--informational {
  background: var(--blue);
}
.legend-dot--commercial {
  background: var(--violet);
}
.legend-dot--transactional {
  background: var(--emerald);
}

/* --------------------------------------------------------------------------
   Table
   -------------------------------------------------------------------------- */

.table-panel {
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 20px 14px;
}

.toolbar-title h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.result-count {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: min(300px, 60vw);
}

.search-wrap input {
  height: 38px;
  padding: 0 12px 0 36px;
  font-size: 13px;
  border-radius: 10px;
}

.search-wrap .input-icon {
  width: 15px;
  height: 15px;
  left: 11px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 0 20px 14px;
}

.filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}

.filter-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.08);
}

.filter-btn.is-active {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, #58a6ff, #388bfd);
  font-weight: 600;
}

.filter-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin-inline: 4px;
}

.sort-hint {
  font-size: 11.5px;
  color: var(--faint);
}

.table-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.table-scroll::-webkit-scrollbar {
  height: 10px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.24);
  border-radius: 999px;
}

.kw-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

.kw-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  text-align: left;
  background: var(--table-head-bg);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.kw-table thead th:first-child {
  padding-left: 8px;
}

.th-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s var(--ease);
}

.th-btn:hover {
  color: var(--text);
}

th.is-sorted .th-btn {
  color: var(--cyan);
}

.sort-arrow {
  position: relative;
  width: 8px;
  height: 11px;
  flex: 0 0 8px;
  opacity: 0.4;
}

.sort-arrow::before,
.sort-arrow::after {
  content: "";
  position: absolute;
  left: 0;
  border-inline: 4px solid transparent;
}

.sort-arrow::before {
  top: 0;
  border-bottom: 4px solid currentColor;
}

.sort-arrow::after {
  bottom: 0;
  border-top: 4px solid currentColor;
}

th[data-direction="asc"] .sort-arrow {
  opacity: 1;
}

th[data-direction="asc"] .sort-arrow::after {
  opacity: 0.25;
}

th[data-direction="desc"] .sort-arrow {
  opacity: 1;
}

th[data-direction="desc"] .sort-arrow::before {
  opacity: 0.25;
}

.kw-table tbody tr {
  transition: background 0.15s var(--ease);
}

.kw-table tbody tr:hover {
  background: rgba(88, 166, 255, 0.045);
}

.kw-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: top;
}

.kw-table tbody tr:last-child td {
  border-bottom: 0;
}

.cell-keyword {
  min-width: 230px;
  padding-left: 20px !important;
}

.kw-text {
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
  text-transform: lowercase;
}

.cell-angle {
  min-width: 300px;
  max-width: 420px;
}

.angle-text {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
}

.cell-tools {
  width: 220px;
  padding-right: 20px !important;
}

.row-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.05);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.tool-btn:hover {
  color: var(--cyan);
  border-color: rgba(88, 166, 255, 0.45);
  background: var(--cyan-soft);
}

.tool-icon {
  font-size: 12px;
  line-height: 1;
}

.th-static {
  display: flex;
  justify-content: flex-end;
  padding: 11px 20px 11px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge--informational {
  color: var(--tone-blue);
  background: var(--blue-soft);
  border-color: rgba(88, 166, 255, 0.3);
}

.badge--commercial {
  color: var(--tone-violet);
  background: var(--violet-soft);
  border-color: rgba(188, 140, 255, 0.32);
}

.badge--transactional {
  color: var(--tone-success);
  background: var(--emerald-soft);
  border-color: rgba(63, 185, 80, 0.32);
}

.badge--navigational {
  color: var(--tone-neutral);
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.3);
}

.badge--easy {
  color: var(--tone-success);
  background: var(--emerald-soft);
  border-color: rgba(63, 185, 80, 0.32);
}

.badge--medium {
  color: var(--tone-warn);
  background: var(--amber-soft);
  border-color: rgba(210, 153, 34, 0.32);
}

.badge--hard {
  color: var(--tone-danger);
  background: var(--red-soft);
  border-color: rgba(248, 81, 73, 0.32);
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.category-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.05);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.copy-btn:hover {
  color: var(--cyan);
  border-color: rgba(88, 166, 255, 0.45);
  background: var(--cyan-soft);
}

.copy-btn.is-copied {
  color: var(--tone-success);
  border-color: rgba(63, 185, 80, 0.45);
  background: var(--emerald-soft);
}

.no-results {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 34px 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13.5px;
}

/* --------------------------------------------------------------------------
   Insights
   -------------------------------------------------------------------------- */

.insights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.insight-card {
  padding: 20px;
}

.insight-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.insight-head > div {
  flex: 1;
  min-width: 0;
}

.insight-head h2 {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.insight-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.insight-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
}

.insight-icon svg {
  width: 19px;
  height: 19px;
}

.insight-icon--paa {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: rgba(88, 166, 255, 0.28);
}

.insight-icon--gap {
  color: var(--violet);
  background: var(--violet-soft);
  border-color: rgba(188, 140, 255, 0.28);
}

.count-badge {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-align: center;
}

.insight-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insight-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(148, 163, 184, 0.05);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.insight-list li:hover {
  border-color: var(--border);
  background: rgba(148, 163, 184, 0.09);
}

.insight-index {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  padding-top: 1px;
}

.gap-marker {
  display: grid;
  place-items: center;
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border-radius: 5px;
  background: var(--violet-soft);
  color: var(--violet);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.insight-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.insight-empty {
  color: var(--muted);
  font-style: italic;
}


/* --------------------------------------------------------------------------
   Contextual AI drawer
   -------------------------------------------------------------------------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 6, 12, 0.66);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s var(--ease);
}

.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: min(760px, calc(100vw - 32px));
  max-height: min(84vh, 900px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--drawer-glass);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  box-shadow: 0 40px 90px -34px rgba(2, 6, 16, 0.9);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.985);
  transition: opacity 0.24s var(--ease), transform 0.3s var(--ease),
    visibility 0.24s var(--ease);
  overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.drawer.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--drawer-head-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.drawer-heading {
  flex: 1;
  min-width: 0;
}

.drawer-heading h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.drawer-keyword {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--tone-info);
  overflow-wrap: anywhere;
}

.icon-btn--light {
  color: var(--muted);
  border-color: var(--border);
}

.icon-btn--light:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.12);
  border-color: var(--border-strong);
}

.drawer-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 18px;
}

.drawer-loading-title {
  font-size: 13.5px;
  font-weight: 700;
}

.drawer-loading-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.drawer-error {
  margin: 18px;
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.09);
}

.drawer-error-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tone-danger);
}

.drawer-error-detail {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--red);
  overflow-wrap: anywhere;
}

.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer-section {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.04);
}

.drawer-section-title {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.drawer-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.drawer-list li {
  display: flex;
  gap: 9px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.drawer-bullet {
  flex: 0 0 auto;
  color: var(--cyan);
}

.drawer-index {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  padding-top: 2px;
}

.drawer-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.drawer-field + .drawer-field {
  margin-top: 10px;
}

.drawer-field-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.drawer-field-value {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.drawer-heading-block + .drawer-heading-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.drawer-h2 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.drawer-sublist {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 7px;
  padding-left: 2px;
}

.drawer-h3 {
  position: relative;
  padding-left: 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.drawer-h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--violet);
}

.drawer-empty {
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
}

/* ------------------------------ Strategy dossier ------------------------- */

.row-clickable {
  cursor: pointer;
}

.row-clickable:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.dossier-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dossier-tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.dossier-tile-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.dossier-tile-value {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.dossier-sub {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--tone-info-border);
  background: var(--cyan-soft);
  color: var(--tone-info);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.dossier-copy-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.dossier-copy-row .drawer-field-value {
  flex: 1 1 auto;
  min-width: 0;
}

.dossier-copy {
  flex: 0 0 auto;
}

.dossier-count {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}

.dossier-count.is-over {
  color: var(--tone-warn);
  font-weight: 700;
}

.drawer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--panel-foot-bg);
}

.drawer-model {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46%;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.drawer-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .drawer {
    width: calc(100vw - 16px);
    max-height: 92vh;
    border-radius: var(--radius-lg);
  }

  .drawer-body {
    padding: 14px 14px 18px;
  }

  .drawer-model {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-block: 20px;
  font-size: 12px;
  color: var(--muted);
}

.footer-meta {
  color: var(--faint);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 50;
  transform: translate(-50%, 14px);
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid var(--toast-success-border);
  background: var(--toast-success-bg);
  color: var(--toast-success-fg);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  max-width: min(92vw, 460px);
  text-align: center;
}

.toast[data-tone="error"] {
  border-color: var(--toast-error-border);
  background: var(--toast-error-bg);
  color: var(--toast-error-fg);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .hunt-form {
    grid-template-columns: minmax(220px, 1fr) 170px 200px;
  }

  .field--submit {
    grid-column: 1 / -1;
  }

  .field--submit .btn {
    width: 100%;
  }

  .skeleton-metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 980px) {
  .panel-head {
    flex-direction: column;
    gap: 16px;
  }

  .status-stack {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 14px;
    width: 100%;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card--wide {
    grid-column: 1 / -1;
  }

  .insights {
    grid-template-columns: 1fr;
  }

  .empty-state {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 28px 24px;
  }

  .empty-graphic {
    max-width: 340px;
    height: 120px;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(1440px, 100% - 28px);
  }

  .header-inner {
    min-height: 64px;
  }

  .header-meta .pill--ghost {
    display: none;
  }

  .main {
    padding-block: 18px 40px;
    gap: 16px;
  }

  .query-panel {
    padding: 20px 18px 16px;
  }

  .hunt-form {
    grid-template-columns: 1fr;
  }

  .field--submit {
    grid-column: auto;
  }

  .toolbar-controls,
  .search-wrap {
    width: 100%;
  }

  .table-toolbar {
    padding: 16px 16px 12px;
  }

  .filter-bar {
    padding: 0 16px 12px;
  }

  .sort-hint,
  .filter-divider {
    display: none;
  }

  .insight-card {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14.5px;
  }

  .brand-tag {
    font-size: 10.5px;
  }

  .header-meta {
    display: none;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metric-card--wide {
    grid-column: auto;
  }

  .kw-table {
    min-width: 0;
  }

  .kw-table thead {
    display: none;
  }

  .kw-table,
  .kw-table tbody,
  .kw-table tr,
  .kw-table td {
    display: block;
    width: 100%;
  }

  .kw-table tbody tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }

  .kw-table tbody tr:last-child {
    border-bottom: 0;
  }

  .kw-table tbody td {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 5px 0;
    border: 0;
    max-width: none;
  }

  .kw-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 82px;
    padding-top: 3px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .cell-keyword {
    min-width: 0;
    padding-left: 0 !important;
  }

  .cell-keyword::before {
    display: none;
  }

  .kw-text {
    font-size: 15px;
  }

  .cell-angle,
  .cell-tools {
    min-width: 0;
    width: 100%;
    text-align: left;
  }

  .cell-tools::before {
    display: none;
  }

  .row-tools {
    justify-content: flex-start;
    margin-top: 4px;
    width: 100%;
  }

  /* Under 640px the row actions collapse to icon-only buttons. */
  .tool-label {
    display: none;
  }

  .tool-btn {
    padding: 8px 11px;
    font-size: 14px;
  }

  .report-head {
    align-items: flex-start;
  }

  .report-actions {
    width: 100%;
  }

  .report-actions .btn {
    flex: 1;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
    transform: translateY(14px);
    max-width: none;
  }

  .toast.is-visible {
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Motion / print preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .ambient,
  .site-header,
  .query-panel,
  .report-actions,
  .site-footer,
  .toast {
    display: none !important;
  }

  body {
    background: #fff;
    color: #0b1220;
  }

  .panel,
  .metric-card {
    border-color: #cbd5e1;
    background: #fff;
    box-shadow: none;
  }

  .kw-table tbody td,
  .insight-list li {
    color: #0b1220;
  }
}

/* --------------------------------------------------------------------------
   Header tools, model selector and run history
   -------------------------------------------------------------------------- */

.header-tool {
  flex: 0 0 auto;
}

#theme-toggle {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: var(--surface);
}

#theme-toggle:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.theme-glyph {
  font-size: 14px;
  line-height: 1;
  display: block;
  transition: transform 0.3s var(--ease);
}

:root[data-theme="light"] .theme-glyph {
  transform: rotate(180deg);
}

#history-open {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#model-select {
  font-size: 13.5px;
}

.history-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.history-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.history-seed {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  overflow-wrap: anywhere;
}

.history-meta {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.history-model {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.history-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

@media (max-width: 640px) {
  #history-open .count-pill {
    margin-left: 2px;
  }

  .history-row-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

/* --------------------------------------------------------------------------
   Difficulty micro-gauges, volume tiers, cluster groups, export hub
   -------------------------------------------------------------------------- */

/* Table cell helpers ------------------------------------------------------ */

.diff-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.diff-gauge {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 116px;
}

.diff-gauge-track {
  position: relative;
  flex: 1 1 auto;
  height: 5px;
  border-radius: 999px;
  background: var(--gauge-track);
  overflow: hidden;
}

.diff-gauge-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--emerald);
  transition: width 0.35s var(--ease);
}

.diff-gauge--mid .diff-gauge-fill {
  background: var(--amber);
}

.diff-gauge--high .diff-gauge-fill {
  background: var(--red);
}

.diff-gauge-value {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.volume-tag {
  display: inline-flex;
  align-items: center;
  margin-top: 7px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.volume-tag--high {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(248, 81, 73, 0.28);
}

.volume-tag--medium {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(210, 153, 34, 0.28);
}

.volume-tag--niche {
  color: var(--cyan);
  background: var(--cyan-soft);
  border-color: rgba(88, 166, 255, 0.26);
}

:root[data-theme="light"] .volume-tag--high {
  border-color: rgba(207, 34, 46, 0.26);
}

:root[data-theme="light"] .volume-tag--medium {
  border-color: rgba(154, 103, 0, 0.26);
}

:root[data-theme="light"] .volume-tag--niche {
  border-color: rgba(9, 105, 218, 0.26);
}

/* Cluster group header rows ---------------------------------------------- */

.kw-table tbody tr.group-row:hover {
  background: transparent;
}

.group-row th {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  text-align: left;
}

.group-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  text-align: left;
}

.group-caret {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  transition: color 0.15s var(--ease);
}

.group-toggle:hover .group-caret,
.group-toggle:hover .group-name {
  color: var(--cyan);
}

.group-name {
  letter-spacing: 0.01em;
}

.group-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

/* View toggle ------------------------------------------------------------- */

.view-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-inset);
}

.view-toggle .filter-btn {
  border: 0;
  background: transparent;
}

/* Export hub -------------------------------------------------------------- */

.menu-wrap {
  position: relative;
}

#export-all .caret {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.8;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: min(280px, 84vw);
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--menu-bg);
  box-shadow: var(--shadow);
  animation: menu-in 0.14s var(--ease);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-3);
}

.menu-item-title {
  font-size: 13px;
  font-weight: 600;
}

.menu-item-hint {
  font-size: 11.5px;
  color: var(--muted);
}

/* Quick-start chips ------------------------------------------------------- */

.quick-start {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.quick-start-label {
  margin-bottom: 9px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.quick-start-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip--quick {
  border-color: rgba(88, 166, 255, 0.26);
  background: var(--cyan-soft);
  color: var(--cyan);
  font-weight: 600;
}

.chip--quick:hover {
  border-color: var(--cyan);
  background: rgba(88, 166, 255, 0.18);
  transform: translateY(-1px);
}

:root[data-theme="light"] .chip--quick {
  border-color: rgba(9, 105, 218, 0.28);
}

:root[data-theme="light"] .chip--quick:hover {
  background: rgba(9, 105, 218, 0.14);
}

/* Shimmer table skeleton -------------------------------------------------- */

.skeleton-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.skeleton-row {
  display: grid;
  grid-template-columns: 2fr 0.8fr 0.9fr 0.8fr 2fr 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.03);
}

.skeleton-row--head {
  opacity: 0.65;
}

.skeleton--cell {
  height: 12px;
  border-radius: 999px;
}

.skeleton--cell-sm {
  height: 10px;
}

.skeleton--cell-wide {
  height: 14px;
}

@media (max-width: 900px) {
  .skeleton-row {
    grid-template-columns: 1.6fr 0.9fr 0.9fr 1.6fr;
  }

  .skeleton-row > :nth-child(2),
  .skeleton-row > :nth-child(6) {
    display: none;
  }
}

@media (max-width: 640px) {
  .skeleton-row {
    grid-template-columns: 1.6fr 1fr 1fr;
  }

  .view-toggle {
    order: -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .diff-gauge-fill,
  .theme-glyph {
    animation: none;
    transition: none;
  }
}

/* Cluster headers on the stacked mobile table ------------------------------ */

@media (max-width: 640px) {
  .kw-table tbody tr.group-row {
    padding: 14px 0 6px;
    border-bottom: 1px solid var(--border);
  }

  .group-row th {
    padding: 0;
    border-bottom: 0;
    background: transparent;
  }

  .group-toggle {
    gap: 8px;
    font-size: 12px;
  }

  .group-count {
    margin-left: auto;
  }

  .diff-gauge {
    max-width: 100%;
  }
}
