:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1f2524;
  --muted: #66706d;
  --line: #d9ded9;
  --accent: #345c52;
  --accent-strong: #153d35;
  --warn: #a25d2a;
  --danger: #9a3e3e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.modal-open { overflow: hidden; }
body[data-locale="zh"] .locale-en,
body[data-locale="en"] .locale-zh { display: none !important; }

.topbar {
  min-height: 68px;
  padding: 12px clamp(16px, 3vw, 42px);
  display: grid;
  grid-template-columns: minmax(150px, .7fr) minmax(260px, 1.2fr) minmax(260px, .9fr);
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
}

h1, h2, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.08; font-weight: 760; letter-spacing: 0; }
h2 { font-size: 17px; line-height: 1.25; letter-spacing: 0; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 760; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.5; }

.site-intro {
  justify-self: center;
  max-width: 560px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}
button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 720;
  cursor: pointer;
}
button.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
button:disabled, input:disabled {
  opacity: .58;
  cursor: not-allowed;
}
.compact-action {
  min-width: 72px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
.mini-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
.danger { color: #9d2d2d !important; }
.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
  display: flex;
  flex-direction: column;
}
.status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}
.status-strip div {
  background: #fff;
  min-height: 72px;
  padding: 14px 16px;
  display: grid;
  gap: 6px;
}
.status-strip span, .settings-list span { color: var(--muted); font-size: 13px; }
.status-strip strong, .settings-list strong { font-size: 15px; }

.grid { display: grid; gap: 20px; margin-bottom: 20px; }
.grid.one { grid-template-columns: minmax(0, 1fr); }
.grid.two { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bottom-dashboard { order: 20; }
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.empty {
  min-height: 180px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 20px;
  color: var(--muted);
}
.empty strong { color: var(--ink); }

.rank-list, .compact-table { display: grid; gap: 8px; }
.compact-table {
  max-width: 100%;
  overflow-x: auto;
}
.rank-row, .table-row, .table-head {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, .7fr);
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.table-head {
  min-height: 34px;
  color: var(--muted);
  background: #f7f8f6;
  font-size: 12px;
  font-weight: 720;
}
.table-row span, .rank-row span, .rank-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px 18px;
}
.trend-readme {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  align-items: baseline;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.trend-readme strong {
  color: var(--accent-strong);
  white-space: nowrap;
}
.trend-category-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(124px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: thin;
}
.trend-category-column {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfa;
}
.trend-category-column header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}
.trend-category-column header strong {
  color: var(--ink);
  font-size: 13px;
}
.trend-category-column header small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}
.trend-tag-list {
  max-height: 244px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  padding-right: 2px;
}
.trend-category-column ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.compact-select-label {
  display: grid;
  gap: 4px;
  width: max-content;
  max-width: 260px;
}
.compact-select-label small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
}
.compact-select-label select {
  width: 100%;
  max-width: 220px;
  min-height: 28px;
  padding: 0 7px;
  font-size: 11px;
}
.trend-tag-detail {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid rgba(217, 222, 217, .78);
  background: transparent;
  overflow: hidden;
}
.trend-tag-detail:last-child {
  border-bottom: 0;
}
.trend-tag-detail summary {
  min-width: 0;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 4px;
  align-items: start;
  padding: 2px 5px;
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1.24;
  font-weight: 600;
}
.trend-category-grid .trend-tag-detail summary {
  font-size: 12.5px;
  line-height: 1.28;
}
.trend-tag-detail summary:hover {
  background: rgba(52, 92, 82, .05);
}
.trend-tag-detail summary::before {
  content: ">";
  color: var(--muted);
}
.trend-tag-detail[open] summary::before {
  transform: rotate(90deg);
}
.trend-tag-detail summary span {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
}
.trend-tag-detail summary em {
  font-style: normal;
  font-weight: 650;
  white-space: nowrap;
}
.mini-trend {
  display: grid;
  gap: 0;
  padding: 1px 5px 4px 16px;
}
.mini-trend svg {
  width: 132px;
  height: 44px;
  overflow: visible;
}
.mini-trend .trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mini-trend .trend-axis,
.mini-trend .trend-grid {
  stroke: var(--line);
  stroke-width: .55;
  shape-rendering: crispEdges;
}
.mini-trend .trend-grid {
  stroke-dasharray: 2 3;
}
.mini-trend .trend-guide {
  stroke: var(--accent);
  stroke-width: .45;
  stroke-dasharray: 2 2;
  opacity: .55;
}
.mini-trend .trend-hit {
  fill: transparent;
  pointer-events: all;
}
.mini-trend .trend-point {
  fill: #fff;
  stroke: var(--accent-strong);
  stroke-width: .9;
}
.mini-trend .trend-value-bg {
  fill: #fbfcfa;
  stroke: rgba(217, 222, 217, .6);
  stroke-width: .4;
  opacity: 0;
  transition: opacity .12s ease;
}
.mini-trend .trend-label {
  fill: var(--muted);
  font-size: 6.5px;
}
.mini-trend .trend-value {
  fill: var(--accent-strong);
  font-size: 7px;
  font-weight: 700;
  opacity: 0;
  transition: opacity .12s ease;
  pointer-events: none;
}
.mini-trend .trend-mark:hover .trend-value,
.mini-trend .trend-mark:hover .trend-value-bg,
.mini-trend .trend-mark:focus .trend-value,
.mini-trend .trend-mark:focus .trend-value-bg {
  opacity: 1;
}
.trend-category-column li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1.35;
}
.trend-category-column li span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.trend-category-column li em {
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-style: normal;
  font-size: 10px;
}
.trend-cross-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.trend-cross-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}
.trend-cross-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.trend-cross-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.cross-filter-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.cross-filter-row {
  display: grid;
  grid-template-columns: minmax(96px, .85fr) minmax(118px, 1fr) max-content;
  gap: 6px;
  align-items: end;
}
.cross-filter-row label {
  min-width: 0;
  gap: 4px;
}
.cross-filter-row small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
}
.cross-filter-row select {
  width: 100%;
  min-height: 28px;
  padding: 0 7px;
  font-size: 11px;
}
.cross-filter-row .mini-button {
  width: auto;
  min-width: 44px;
  justify-self: start;
  min-height: 28px;
  padding-inline: 9px;
  font-size: 11px;
}
.cross-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 8px;
}
.cross-dimension-column {
  min-width: 0;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fbfcfa;
  scrollbar-width: thin;
}
.cross-dimension-column header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.cross-dimension-column header strong {
  font-size: 12px;
}
.cross-dimension-column header small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}
.cross-dimension-column .trend-tag-detail {
  margin-bottom: 4px;
}
.cross-samples {
  display: grid;
  gap: 2px;
  padding: 0 3px 3px 12px;
}
.cross-samples > strong {
  color: var(--muted);
  font-size: 8.5px;
}
.cross-sample-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 2px;
  max-height: 34px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding-right: 2px;
}
.cross-samples button {
  width: 18px;
  height: 16px;
  min-height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0;
  background: #fff;
  color: var(--accent-strong);
  font-size: 8px;
  font-weight: 650;
  text-align: center;
  cursor: pointer;
}
.cross-samples button:hover {
  border-color: var(--accent);
}
.source-keyword-stack {
  display: grid;
  gap: 10px;
}
.home-config-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.home-config-group > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  cursor: pointer;
}
.home-config-group > summary::after {
  content: "◂";
  justify-self: end;
  color: var(--accent-strong);
  font-size: 13px;
}
.home-config-group[open] > summary::after { content: "▾"; }
.home-config-group > summary strong {
  color: var(--ink);
  font-size: 14px;
}
.home-config-group > summary span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}
.general-summary-actions {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.general-summary-actions small {
  max-width: 250px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.25;
  text-align: right;
}
.scan-start-button {
  min-height: 28px;
  padding: 0 10px;
  border-color: #08775b;
  border-radius: 6px;
  background: #08775b;
  color: #fff;
  font-size: 11px;
  font-weight: 760;
  box-shadow: 0 1px 2px rgba(8, 82, 64, .2);
  white-space: nowrap;
}
.scan-start-button:hover:not(:disabled) { background: #065f49; border-color: #065f49; }
.scan-start-button:disabled { border-color: var(--line); background: #d8ddda; color: #78817c; box-shadow: none; cursor: not-allowed; }
.general-summary-actions .scan-start-button span { color: #fff; font-size: inherit; }
.general-summary-actions .scan-start-button:disabled span { color: #78817c; }
.scan-stop-button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid #b95757;
  border-radius: 6px;
  background: #fff;
  color: #9f3434;
  font-size: 11px;
  white-space: nowrap;
}
.scan-stop-button:hover:not(:disabled) { background: #fff3f1; }
.general-summary-actions .scan-stop-button span { color: #9f3434; font-size: inherit; }
.home-config-group > .source-summary,
.home-config-group > .dimension-map,
.home-config-group > .keyword-preview-list {
  margin: 0 12px 12px;
}
.home-config-group > .source-summary,
.home-config-group > .keyword-preview-list {
  max-height: 276px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.source-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}
.source-summary div,
.source-toggle-row {
  display: grid;
  grid-template-columns: minmax(54px, .25fr) minmax(120px, .8fr) minmax(0, 1fr) minmax(74px, auto) auto;
  gap: 6px;
  align-items: center;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.source-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.source-inline-form input,
.source-inline-form select {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}
.source-summary span,
.source-summary small {
  color: var(--muted);
  font-size: 12px;
}
.source-summary strong { font-size: 15px; }
.dimension-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.home-other-group {
  margin: 0 12px 12px;
  border-top: 1px solid var(--line);
}
.home-other-group > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 2px;
  list-style: none;
  cursor: pointer;
}
.home-other-group > summary::-webkit-details-marker { display: none; }
.home-other-group > summary::after {
  content: "◂";
  margin-left: auto;
  color: var(--accent-strong);
  font-size: 10px;
  line-height: 1;
}
.home-other-group[open] > summary::after { content: "▾"; }
.home-other-group > summary strong {
  color: var(--ink);
  font-size: 12px;
}
.home-other-group > .dimension-map { margin: 2px 0 0; }
.dimension-index {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.dimension-index span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 760;
}
.dimension-card {
  min-width: 0;
  display: grid;
  gap: 4px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: #fbfcfa;
}
.dimension-card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.dimension-card strong { font-size: 14px; }
.dimension-card-title span {
  color: var(--muted);
  font-size: 11px;
}
.dimension-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.dimension-subsection {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.dimension-subsection + .dimension-subsection {
  margin-top: 3px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}
.dimension-subtitle {
  color: var(--muted);
  font-size: 10px !important;
  font-weight: 760;
}
.dimension-values {
  display: grid;
  gap: 2px;
  max-height: 176px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.dimension-values > span {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 7px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.35;
  font-style: normal;
  overflow-wrap: anywhere;
  white-space: normal;
}
.dimension-value-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px 38px 22px;
  gap: 3px;
  align-items: center;
}
.dimension-value-form input,
.dimension-add-form input {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 10px;
  line-height: 1.25;
}
.dimension-value-form input[readonly] {
  border-color: transparent;
  background: transparent;
  padding-inline: 2px;
  cursor: default;
}
.dimension-value-form.is-editing input {
  border-color: var(--line);
  background: #fff;
  padding-inline: 6px;
}
.dimension-value-form > span {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  text-align: center;
  font-size: 10px;
}
.dimension-action {
  min-width: 0;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border-radius: 6px;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}
.dimension-action.edit-action { width: 38px; }
.dimension-action.delete-action {
  width: 22px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}
.dimension-action.danger { color: var(--danger); }
.dimension-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px 38px 22px;
  gap: 3px;
  align-items: center;
  padding-right: 2px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.dimension-add-form input { grid-column: 1; }
.dimension-add-action { grid-column: 3; }
.save-status {
  min-width: 82px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}
.save-status[data-state="saving"] { color: var(--warn); }
.save-status[data-state="saved"] { color: var(--accent); }
.save-status[data-state="failed"] { color: #a83535; border-color: #d7a0a0; }
.compact-panel { min-height: 250px; }
.control-grid {
  display: grid;
  gap: 12px;
}
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.model-table .table-head,
.model-table .table-row {
  grid-template-columns: minmax(72px, .45fr) minmax(120px, 1fr) minmax(104px, .7fr) minmax(130px, 1fr) minmax(76px, .5fr) minmax(190px, 1.2fr);
}
.model-row input,
.model-row select,
.inline-controls input,
.inline-controls select {
  width: 100%;
  min-height: 34px;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.user-table .table-head,
.user-table .table-row {
  grid-template-columns: minmax(100px, 1fr) minmax(72px, .55fr) minmax(72px, .55fr) minmax(72px, .55fr) minmax(148px, 1fr) minmax(86px, .7fr);
}
.usage-table .table-head,
.usage-table .table-row {
  grid-template-columns: minmax(130px, 1fr) minmax(90px, .55fr) minmax(96px, .7fr) minmax(96px, .7fr) minmax(148px, 1fr) minmax(86px, .7fr);
}
.channel-table { margin-top: 14px; }
.keyword-preview-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.home-settings-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px 8px;
}
.home-settings-form label {
  display: grid;
  gap: 4px;
}
.home-settings-form span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}
.home-settings-form input,
.home-settings-form select {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}
.home-settings-form .toggle-setting {
  display: grid;
  gap: 4px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}
.toggle-setting-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.toggle-setting input {
  position: absolute;
  width: 1px !important;
  height: 1px;
  min-height: 1px !important;
  opacity: 0;
}
.toggle-setting i {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: #cfd6d2;
  cursor: pointer;
}
.toggle-setting i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform .16s ease;
}
.toggle-setting input:checked + i { background: var(--accent); }
.toggle-setting input:checked + i::after { transform: translateX(14px); }
.toggle-setting input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-settings-actions {
  grid-column: 3;
  display: flex;
  align-self: end;
  justify-content: flex-end;
  gap: 8px;
}
.home-general-settings-form {
  margin: 0 12px 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.run-summary-table .table-head,
.run-summary-table .table-row {
  grid-template-columns: minmax(240px, 1.45fr) minmax(170px, .85fr) minmax(110px, .5fr) minmax(190px, .8fr);
}
.run-summary-row {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-raised);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.run-summary-row:hover {
  background: var(--panel-low);
}
.run-summary-cell {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
}
.run-summary-cell strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.run-summary-cell small {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.run-time-cell { text-align: right; }
.run-summary-table .table-row span {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.35;
}
.run-detail-list {
  display: grid;
  grid-template-columns: minmax(96px, .35fr) minmax(0, 1fr);
  gap: 8px 10px;
}
.run-detail-list span {
  color: var(--muted);
  font-size: 12px;
}
.run-detail-list strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.trend-period-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.trend-title-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.trend-title-group h2 {
  flex: 0 0 auto;
}
.trend-keyword-select {
  width: 142px;
  min-width: 0;
  height: 26px;
  min-height: 26px;
  padding: 2px 22px 2px 6px;
  text-align: center;
  text-align-last: center;
  font-size: 10px;
}
.trend-period-control small {
  white-space: nowrap;
}
.trend-period-control select {
  width: 132px;
  min-width: 132px;
  min-height: 26px;
  height: 26px;
  padding-inline: 3px;
  text-align: center;
  text-align-last: center;
  font-size: 10px;
}
.trend-overview-controls {
  min-width: 0;
  gap: 6px;
}
.trend-metric-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, 44px);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.trend-metric-toggle button {
  min-height: 27px;
  padding: 0 5px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
}
.trend-metric-toggle button + button {
  border-left: 1px solid var(--line);
}
.trend-metric-toggle button.is-active {
  background: var(--accent);
  color: #fff;
}
.detail-data-panel {
  padding: 0;
}
.detail-data-details > summary {
  list-style: none;
  margin: 0;
  padding: 18px;
  cursor: pointer;
}
.detail-data-details > summary::-webkit-details-marker,
.source-data-group > summary::-webkit-details-marker {
  display: none;
}
.detail-data-summary::after,
.source-data-group > summary::after {
  content: "▾";
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 13px;
}
.detail-data-details:not([open]) > .detail-data-summary::after,
.source-data-group:not([open]) > summary::after {
  content: "◂";
}
.detail-data-summary .inline-controls {
  margin-left: auto;
}
.detail-data-summary select {
  min-height: 30px;
  max-width: 170px;
  padding: 0 7px;
  font-size: 11px;
}
.detail-data-details > .source-data-groups,
.detail-data-details > .empty {
  margin: 0 18px 18px;
}
.keyword-preview-row {
  min-width: 0;
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 5px;
  background: #fff;
}
.keyword-preview-main {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
}
.keyword-preview-main strong {
  min-width: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.keyword-preview-main > span {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 11px;
}
.keyword-preview-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}
.keyword-preview-meta span,
.keyword-preview-meta label {
  min-width: 0;
  border-left: 2px solid #d7e5de;
  padding-left: 8px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.keyword-preview-meta small {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
}
.keyword-inline-form input,
.keyword-inline-form select {
  min-width: 0;
  min-height: 26px;
  padding: 3px 5px;
  font-size: 10px;
}
.keyword-preview-main .keyword-name-input {
  flex: 1 1 84px;
  width: auto;
  max-width: 100%;
}
.keyword-preview-main select {
  flex: 0 0 62px;
  width: 62px;
  padding-inline: 4px;
}
.keyword-row-action {
  flex: 0 0 auto;
  min-height: 26px;
  border-radius: 5px;
  padding: 2px;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}
.keyword-edit-action { width: 38px; }
.keyword-delete-action {
  width: 22px;
  padding: 0;
  color: var(--danger);
  font-size: 14px;
  line-height: 1;
}
.keyword-inline-form:not(.is-editing) input[readonly],
.keyword-inline-form:not(.is-editing) select:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  opacity: 1;
  cursor: default;
}
.keyword-inline-form:not(.is-editing) input[readonly] { padding-inline: 2px; }
.keyword-inline-form:not(.is-editing) select:disabled {
  appearance: none;
  padding-inline: 2px;
}
.keyword-inline-form.is-editing input,
.keyword-inline-form.is-editing select {
  border-color: var(--line);
  background: #fff;
}
.keyword-preview-meta input { width: 100%; }
.keyword-admin-table {
  min-width: 0;
  overflow-x: hidden;
}
.keyword-admin-table .table-head,
.keyword-admin-table .table-row {
  min-width: 0;
  grid-template-columns: minmax(78px, .9fr) minmax(54px, .52fr) minmax(62px, .58fr) minmax(58px, .52fr) minmax(66px, .58fr) minmax(70px, .62fr) minmax(78px, .7fr) minmax(92px, .82fr) minmax(72px, .65fr) minmax(84px, .74fr) minmax(78px, .68fr) minmax(54px, .5fr);
  gap: 6px;
  padding-inline: 8px;
  font-size: 12px;
}
.keyword-admin-table .table-row,
.keyword-admin-table .table-head {
  align-items: start;
}
.keyword-admin-table .table-row span,
.keyword-admin-table .table-head span {
  white-space: normal;
  text-overflow: clip;
  overflow-wrap: anywhere;
  line-height: 1.35;
  min-width: 0;
}
.keyword-admin-table .table-row span {
  max-height: calc(1.35em * 5);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.keyword-admin-table .table-head span {
  overflow: visible;
}
.keyword-admin-table .mini-button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
}
.keyword-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 10px;
  margin-bottom: 16px;
}
.keyword-form input,
.keyword-form select {
  width: 100%;
  min-width: 0;
}
.keyword-edit-panel {
  width: 1040px;
  max-width: 1040px;
  min-width: 1040px;
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.keyword-edit-panel[hidden] { display: none; }
.keyword-edit-panel input,
.keyword-edit-panel select {
  width: 100%;
  min-width: 0;
}
.keyword-edit-meta {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.inline-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: min(420px, 100%);
}
.chart-card {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}
.chart-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 999px;
}
.view-line { background: var(--accent); }
.use-line { background: var(--warn); }
.chart-card svg {
  width: 100%;
  height: auto;
  display: block;
}
.chart-card line {
  stroke: #cfd6d1;
  stroke-width: 1;
}
.chart-card polyline {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.views-line { stroke: var(--accent); }
.uses-line { stroke: var(--warn); }
.views-dot { fill: var(--accent); }
.uses-dot { fill: var(--warn); }
.chart-days {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
}
details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 720;
}
.detail-box {
  margin-top: 8px;
  max-height: 150px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  white-space: pre-wrap;
  font-size: 12px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.metric-grid div {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  display: grid;
  align-content: space-between;
}
.metric-grid span { color: var(--muted); font-size: 13px; }
.metric-grid strong { font-size: 22px; }
.block-note { margin-top: 12px; }
.compact-empty { min-height: 120px; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 37, 36, .34);
}
.modal-backdrop[hidden] { display: none; }
.settings-modal {
  width: min(1120px, 100%);
  max-height: min(880px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(31, 37, 36, .22);
  overflow: hidden;
}
.settings-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
}
.settings-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  overflow-x: auto;
}
.tab-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  white-space: nowrap;
}
.tab-button.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.settings-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}
.settings-pane { display: none; min-width: 0; }
.settings-pane.is-active {
  display: block;
  min-height: 650px;
}
.pane-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.invite-admin-card { grid-column: 1 / -1; min-height: 0; }
.invite-policy-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.invite-policy-row .toggle-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-low);
}
.invite-policy-row .toggle-setting-control {
  width: auto;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
}
.invite-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 96px 190px auto;
  gap: 8px;
  align-items: end;
}
.invite-create-form label { gap: 3px; font-size: 10px; }
.invite-create-form input,
.invite-create-form button { min-height: 34px; }
.invite-code-result {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(260px, 1.4fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--accent);
  background: var(--panel-low);
}
.invite-code-result[hidden] { display: none; }
.invite-code-result > div { display: grid; gap: 2px; }
.invite-code-result code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 760;
}
.invite-list {
  display: grid;
  gap: 4px;
  max-height: 190px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.invite-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 64px minmax(150px, .7fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.invite-row > span:first-child { display: grid; gap: 2px; }
.invite-row small { color: var(--muted); font-size: 9px; }
.invite-row .row-actions { justify-content: flex-end; flex-wrap: nowrap; }
.invite-row .danger { width: 22px; min-width: 22px; padding: 0; }
.source-data-groups { display: grid; gap: 12px; }
.source-data-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}
.source-data-group > summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  padding: 12px 14px;
}
.source-data-group > summary span {
  color: var(--muted);
  font-size: 12px;
}
.source-post-list {
  display: grid;
  gap: 12px;
  max-height: 780px;
  overflow: auto;
  padding: 0 12px 12px;
}
.source-post-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.source-post-head {
  display: grid;
  gap: 4px;
}
.source-post-head span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.image-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.image-grid figure {
  min-width: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.image-grid img,
.image-missing {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f6;
}
.image-missing {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}
.image-grid figcaption {
  display: grid;
  gap: 3px;
  font-size: 11px;
  line-height: 1.35;
}
.image-grid a {
  color: var(--accent);
  overflow-wrap: anywhere;
}
.compact-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfcfa;
}
.compact-details summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 720;
}
.raw-data-box pre,
.analysis-box pre,
.compact-details pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfa;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.compact-source-post {
  gap: 8px;
  padding: 10px;
}
.compact-source-post .source-post-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}
.source-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: baseline;
}
.source-title-meta,
.post-modal-title-meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.source-title-meta b,
.post-modal-title-meta b {
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 720;
  text-transform: uppercase;
}
.source-time-line,
.source-author-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}
.source-author-line {
  margin-top: 2px;
}
.source-post-head strong {
  font-size: 14px;
}
.source-score-pair {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  text-align: center;
  color: var(--accent-strong);
}
.source-score-pair span {
  display: grid;
  justify-items: center;
  gap: 1px;
  min-width: 28px;
}
.source-score-pair strong {
  color: var(--accent-strong);
  font-size: 11px;
  line-height: 1.1;
}
.source-score-pair small {
  color: var(--muted);
  font-size: 8.5px;
}
.ai-summary-line {
  display: block;
  font-size: 12px;
  line-height: 1.35;
}
.ai-summary-line strong {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-strong);
}
.ai-summary-line span {
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}
.local-image-button {
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  line-height: inherit;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}
.local-image-button:disabled {
  cursor: wait;
  opacity: .55;
}
.source-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 78px;
  overflow: auto;
}
.source-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  background: #fbfcfa;
  color: var(--accent-strong);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.source-post-tags {
  max-height: 54px;
}
.source-post-tags span {
  color: var(--muted);
  background: #fff;
}
.post-text-preview {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.post-text-details {
  font-size: 12px;
}
.post-text-details summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  cursor: pointer;
}
.post-text-label {
  color: var(--muted);
  font-weight: 700;
}
.post-text-details p {
  margin-top: 6px;
  max-height: 180px;
  overflow: auto;
  line-height: 1.5;
}
.source-thumb-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 92px;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.source-thumb-strip figure {
  min-width: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}
.thumb-button {
  position: relative;
  display: block;
  width: 92px;
  height: 92px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f7f8f6;
}
.thumb-button img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.thumb-button b {
  position: absolute;
  left: 5px;
  top: 5px;
  border-radius: 999px;
  padding: 2px 5px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  line-height: 1;
}
.source-thumb-strip figcaption {
  display: grid;
  gap: 2px;
  font-size: 10px;
  line-height: 1.25;
}
.source-thumb-strip figcaption a {
  min-width: 0;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-details pre {
  max-height: 160px;
}
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 22, 20, .78);
}
.image-modal[hidden] { display: none; }
.image-modal figure {
  width: min(1100px, 96vw);
  max-height: 92vh;
  margin: 0;
  display: grid;
  gap: 10px;
}
.image-modal img {
  max-width: 100%;
  max-height: 84vh;
  object-fit: contain;
  border-radius: 8px;
  background: #111;
}
.image-modal figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
}
.post-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 22, 20, .62);
}
.post-modal[hidden] { display: none; }
.post-modal article {
  width: min(980px, 96vw);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(16, 22, 20, .24);
}
.post-modal header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.post-modal h3 {
  margin: 0 0 4px;
  font-size: 18px;
}
.post-modal p {
  margin: 0;
}
.post-modal [data-post-modal-meta] {
  color: var(--muted);
  font-size: 12px;
}
.post-modal [data-post-modal-body] {
  min-height: 0;
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
.scan-modal article {
  width: min(720px, 96vw);
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.scan-preview {
  min-height: 180px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 2px;
}
.scan-scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.scan-scope-grid section {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.scan-scope-grid strong { font-size: 12px; }
.scan-tag-list {
  max-height: 112px;
  overflow: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  margin-top: 8px;
  scrollbar-width: thin;
}
.scan-tag-list span {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 10px;
  line-height: 1.2;
}
.scan-estimates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.scan-estimates > span {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-top: 2px solid #d7e5de;
}
.scan-estimates small { color: var(--muted); font-size: 9px; }
.scan-estimates strong { font-size: 16px; }
.scan-limit-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 10px;
}
.scan-limit-line strong { color: var(--ink); }
.scan-cost-note,
.scan-warning {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f3f6f4;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.scan-warning { background: #fff1e8; color: var(--warn); }
.scan-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.scan-modal-actions button { min-height: 34px; }
.scan-result-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.scan-result-summary span {
  display: grid;
  gap: 2px;
  padding: 7px;
  border-top: 2px solid #d7e5de;
  color: var(--muted);
  font-size: 9px;
}
.scan-result-summary strong { color: var(--ink); font-size: 15px; }
.scan-detail-scope,
.scan-detail-time {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.scan-result-list {
  max-height: 240px;
  overflow: auto;
  display: grid;
  gap: 3px;
  scrollbar-width: thin;
}
.scan-result-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 70px;
  gap: 7px;
  align-items: center;
  min-height: 27px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 10px;
}
.scan-result-row span,
.scan-result-row small { color: var(--muted); }
.scan-result-row p {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--danger);
  font-size: 9px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scan-result-row .scan-result-metrics {
  color: var(--muted);
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}
.auth-shell {
  width: min(920px, 100%);
  display: grid;
  gap: 20px;
}
.auth-brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.auth-brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  margin-top: 3px;
}
.auth-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.auth-brand h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1;
  letter-spacing: 0;
}
.auth-brand-zh {
  margin: 4px 0 6px;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 760;
}
.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.auth-panel {
  min-height: 388px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  display: grid;
  align-content: start;
  gap: 18px;
}
.auth-panel-heading {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.auth-panel-heading h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 0;
  font-size: 22px;
}
.auth-panel-heading h2 small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.auth-notice {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.auth-notice span { font-size: 12px; }
.auth-label-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.auth-label-copy strong { color: var(--ink); font-size: 12px; }
.auth-label-copy small { color: var(--muted); font-size: 11px; font-weight: 600; }
.auth-panel button[type="submit"] {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
}
.auth-panel button[type="submit"] span { font-size: 11px; font-weight: 700; }
.auth-panel button:disabled { cursor: not-allowed; opacity: .45; }
.auth-panel .small { margin: 0; line-height: 1.5; }
.login-form {
  display: grid;
  gap: 14px;
}
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
}
textarea {
  width: 100%;
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  resize: vertical;
}
.wide-label { display: grid; gap: 8px; }
.settings-section + .settings-section { margin-top: 16px; }
.setting-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfa;
}
.setting-note strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}
.setting-note p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.notice {
  border: 1px solid #e0c99b;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff8e8;
  color: #7a4e16;
  font-size: 13px;
}
.secondary-form { border-top: 1px solid var(--line); padding-top: 18px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
  }
  .site-intro {
    justify-self: stretch;
    text-align: left;
    max-width: none;
  }
  .top-actions {
    justify-self: stretch;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .status-strip, .grid.two, .grid.three, .metric-grid { grid-template-columns: 1fr; }
  .trend-readme { grid-template-columns: 1fr; }
  .trend-category-grid {
    grid-template-columns: repeat(8, minmax(148px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .trend-cross-head { grid-template-columns: 1fr; display: grid; }
  .cross-filter-list { grid-template-columns: 1fr; }
  .cross-filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding-bottom: 0;
  }
  .cross-filter-row .mini-button {
    grid-column: 1 / -1;
    justify-self: end;
    min-height: 24px;
  }
  .cross-result-grid { grid-template-columns: minmax(0, 1fr); }
  .home-config-group > summary { grid-template-columns: minmax(0, 1fr) auto; }
  .home-config-group > summary > span { grid-column: 1 / -1; }
  .general-summary-actions { width: 100%; justify-content: space-between; }
  .general-summary-actions small { max-width: none; text-align: left; }
  .scan-scope-grid { grid-template-columns: 1fr; }
  .scan-estimates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scan-result-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scan-result-row { grid-template-columns: 70px minmax(0, 1fr) 58px; }
  .source-summary div, .source-toggle-row { grid-template-columns: 1fr; gap: 4px; }
  .home-settings-form { grid-template-columns: 1fr; }
  .home-settings-actions { grid-column: 1; }
  .dimension-map { grid-template-columns: 1fr; }
  .keyword-preview-list { grid-template-columns: 1fr; }
  .rank-row, .table-row, .table-head { grid-template-columns: minmax(0, 1fr) minmax(0, .7fr); }
  .rank-row span:last-child, .table-row span:last-child, .table-head span:last-child { display: none; }
  .run-summary-table .run-summary-head { display: none; }
  .run-summary-table .run-summary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 12px;
    padding: 9px 8px;
  }
  .run-summary-row .run-scope-cell,
  .run-summary-row .run-time-cell { grid-column: 1 / -1; }
  .run-summary-row .run-time-cell { text-align: left; }
  .run-summary-row span:last-child { display: inline; }
  .keyword-preview-meta { grid-template-columns: 1fr; }
  .keyword-preview-main,
  .source-post-head,
  .post-text-details summary { grid-template-columns: 1fr; }
  .source-thumb-strip { grid-auto-columns: 86px; }
  .keyword-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keyword-form button { grid-column: 1 / -1; }
  .keyword-edit-panel {
    width: calc(100vw - 84px);
    max-width: calc(100vw - 84px);
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .keyword-edit-meta {
    grid-column: 1 / -1;
  }
  .model-table .table-head,
  .model-table .table-row,
  .user-table .table-head,
  .user-table .table-row,
  .usage-table .table-head,
  .usage-table .table-row { grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); }
  .model-table .table-row > :nth-child(n+3),
  .model-table .table-head > :nth-child(n+3),
  .user-table .table-row > :nth-child(n+3),
  .user-table .table-head > :nth-child(n+3),
  .usage-table .table-row > :nth-child(n+3),
  .usage-table .table-head > :nth-child(n+3) { display: none; }
  .user-table .table-row,
  .user-table .table-head,
  .usage-table .table-row,
  .usage-table .table-head { grid-template-columns: minmax(0, 1fr) minmax(86px, .7fr); }
  .user-table .table-row > :nth-child(n+2):not(:last-child),
  .user-table .table-head > :nth-child(n+2):not(:last-child),
  .usage-table .table-row > :nth-child(n+2):not(:last-child),
  .usage-table .table-head > :nth-child(n+2):not(:last-child) { display: none; }
  .user-table .table-row > :last-child,
  .user-table .table-head > :last-child,
  .usage-table .table-row > :last-child,
  .usage-table .table-head > :last-child { display: block; }
  .panel-title { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
  .panel-title > h2 { flex: 0 0 100%; }
  .trend-title-group { max-width: 100%; }
  .trend-keyword-select { width: 128px; }
  .inline-controls { width: 100%; min-width: 0; justify-content: flex-start; flex-wrap: wrap; }
  .modal-backdrop { padding: 10px; place-items: stretch; }
  .settings-modal { max-height: calc(100vh - 20px); }
  .settings-header { align-items: flex-start; }
  .settings-tabs { padding: 10px; }
  .settings-content { padding: 12px; }
  .pane-grid { grid-template-columns: 1fr; gap: 12px; }
  .invite-admin-card { grid-column: 1; }
  .invite-create-form { grid-template-columns: minmax(0, 1fr) 88px; }
  .invite-create-form label:nth-of-type(2), .invite-create-form button { grid-column: 1 / -1; }
  .invite-code-result { grid-template-columns: 1fr auto; }
  .invite-code-result code { grid-column: 1 / -1; grid-row: 2; }
  .invite-row { grid-template-columns: minmax(110px, 1fr) 52px auto; }
  .invite-row > :nth-child(3) { display: none; }
  .settings-pane.is-active { min-height: calc(100vh - 190px); }
  .source-data-group > summary { flex-direction: column; }
  .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 2026 terminal theme: approved dark/light system, layered over the stable workbench. */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf0eb;
  --panel: #f9fbf7;
  --panel-raised: #ffffff;
  --panel-low: #e5e9e3;
  --ink: #111814;
  --muted: #5f6b64;
  --line: #aeb9b1;
  --line-strong: #758279;
  --accent: #16764b;
  --accent-strong: #075b36;
  --signal: #b8f500;
  --coral: #e6513e;
  --warn: #9a4a18;
  --danger: #bf342b;
  --shadow: rgba(17, 24, 20, .12);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090c0a;
  --panel: #101411;
  --panel-raised: #171d18;
  --panel-low: #0c100d;
  --ink: #f0f5ed;
  --muted: #92a097;
  --line: #303a33;
  --line-strong: #59665d;
  --accent: #81d92b;
  --accent-strong: #b8f500;
  --signal: #b8f500;
  --coral: #ff6b53;
  --warn: #ffb24a;
  --danger: #ff6b53;
  --shadow: rgba(0, 0, 0, .42);
}

html { background: var(--bg); }
body {
  background-color: var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: Geist, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  transition: background-color .22s ease, color .22s ease;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg);
  opacity: .94;
  pointer-events: none;
}

.topbar {
  min-height: 58px;
  padding: 8px clamp(14px, 2.4vw, 36px);
  grid-template-columns: minmax(150px, .65fr) minmax(280px, 1.5fr) auto;
  gap: 14px;
  border-bottom: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 34px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 80;
}
.topbar > .brand-lockup { display: flex; align-items: center; gap: 9px; }
.brand-lockup > div { min-width: 0; }
.brand-mark {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: block;
}
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand-mark-light { display: none !important; }
:root[data-theme="light"] .brand-mark-dark { display: none !important; }
:root[data-theme="light"] .brand-mark-light { display: block !important; }
.topbar .eyebrow { margin: 0; color: var(--accent-strong); font-size: 9px; }
.topbar h1 { font-size: 20px; font-weight: 780; }
.site-intro { color: var(--muted); font-size: 12px; font-weight: 560; }
.top-actions { gap: 5px; }
.top-actions form { display: flex; }
.top-actions .pill { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.theme-toggle {
  height: 30px;
  display: grid;
  grid-template-columns: repeat(2, 28px);
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-low);
}
.theme-toggle button {
  min-width: 0;
  min-height: 24px;
  height: 24px;
  padding: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.theme-toggle button.is-active { background: var(--ink); color: var(--bg); }

button,
button.ghost,
.pill,
input,
select,
textarea {
  border-color: var(--line);
  border-radius: 3px;
}
button { background: var(--accent); color: #071007; }
:root[data-theme="light"] button { color: #fff; }
:root[data-theme="light"] button.ghost,
:root[data-theme="light"] .theme-toggle button,
:root[data-theme="light"] .local-image-button { color: var(--ink); }
:root[data-theme="light"] .theme-toggle button.is-active { color: var(--bg); }
button.ghost { background: var(--panel-raised); color: var(--ink); }
button:hover:not(:disabled) { border-color: var(--accent-strong); transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
.compact-action { min-width: 58px; min-height: 30px; height: 30px; }
.mini-button { min-height: 28px; }
.pill { min-height: 30px; background: var(--panel-low); color: var(--muted); }
input, select, textarea { background: var(--panel-low); color: var(--ink); }
select option { background: var(--panel-raised); color: var(--ink); }

.shell { width: min(1520px, calc(100% - 28px)); margin: 14px auto 42px; }
.grid { gap: 12px; margin-bottom: 12px; }
.panel,
.home-config-group,
.trend-category-column,
.trend-cross-panel,
.cross-dimension-column,
.settings-section,
.chart-card,
.source-data-group,
.source-post,
.detail-box,
.scan-scope-grid section,
.scan-estimates span {
  border-color: var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: none;
}
.panel { padding: 14px; }
.panel-title { margin-bottom: 10px; }
.panel-title h2 { font-size: 15px; text-transform: uppercase; }
.panel-title h2::before { content: "//"; margin-right: 7px; color: var(--accent-strong); }

.status-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 12px;
  border-color: var(--line);
  border-radius: 4px;
  background: var(--line);
}
.status-strip div { min-height: 54px; padding: 9px 12px; background: var(--panel-low); }
.status-strip div:first-child { border-left: 3px solid var(--accent-strong); }
.status-strip span, .settings-list span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.status-strip strong, .settings-list strong { font-size: 12px; }

.trend-intelligence-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 10px;
  align-items: stretch;
}
.trend-category-grid {
  grid-template-columns: repeat(8, minmax(116px, 1fr));
  gap: 5px;
  min-width: 0;
}
.trend-category-column { padding: 8px; background: var(--panel-low); }
.trend-category-column header { border-bottom-color: var(--line); }
.trend-category-column header strong { color: var(--ink); }
.trend-tag-list { max-height: 292px; }
.trend-tag-detail { border-bottom-color: var(--line); }
.trend-tag-detail summary { color: var(--ink); }
.trend-tag-detail summary::before { color: var(--accent-strong); }
.trend-tag-detail summary:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.trend-tag-detail summary em { color: var(--accent-strong); }
.mini-trend .trend-line,
.mini-trend .trend-guide { stroke: var(--accent-strong); }
.mini-trend .trend-point { fill: var(--panel); stroke: var(--accent-strong); }
.mini-trend .trend-value-bg { fill: var(--panel-raised); stroke: var(--line); }
.mini-trend .trend-label { fill: var(--muted); }
.mini-trend .trend-value { fill: var(--accent-strong); }

.evidence-rail {
  min-width: 0;
  border: 1px solid var(--line);
  border-top: 2px solid var(--coral);
  border-radius: 4px;
  padding: 8px;
  background: var(--panel-low);
}
.evidence-rail header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.evidence-rail header div { display: grid; gap: 2px; }
.evidence-rail header small { color: var(--coral); font-size: 8px; text-transform: uppercase; }
.evidence-rail header strong { font-size: 12px; }
.evidence-rail header b { color: var(--accent-strong); font-size: 18px; }
.evidence-filmstrip { max-height: 310px; display: grid; gap: 5px; overflow-y: auto; scrollbar-width: thin; }
.evidence-filmstrip button {
  position: relative;
  min-height: 70px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 2px 7px;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  overflow: hidden;
}
:root[data-theme="light"] .evidence-filmstrip button { color: var(--ink); }
.evidence-filmstrip img { grid-row: 1 / 3; width: 58px; height: 60px; object-fit: cover; filter: saturate(.88) contrast(1.04); }
.evidence-filmstrip span { color: var(--coral); font: 700 9px ui-monospace, Consolas, monospace; }
.evidence-filmstrip strong { align-self: start; font-size: 10px; line-height: 1.25; font-weight: 620; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.evidence-filmstrip button:hover img { transform: scale(1.06); }
.evidence-more { width: 100%; min-height: 28px; margin-top: 7px; padding: 0 8px; font-size: 9px; text-transform: uppercase; }

.trend-cross-panel { margin-top: 10px; padding: 9px; background: var(--panel-low); }
.cross-filter-list { gap: 5px; }
.cross-result-grid { grid-template-columns: repeat(auto-fit, minmax(156px, 1fr)); gap: 5px; }
.cross-dimension-column { background: var(--panel); }
.cross-samples button { background: var(--panel-raised); color: var(--accent-strong); }
.trend-metric-toggle,
.trend-metric-toggle button,
.trend-keyword-select,
.trend-period-control select { border-radius: 3px; }
.trend-metric-toggle button.is-active { background: var(--accent); color: #071007; }
:root[data-theme="light"] .trend-metric-toggle button.is-active { color: #fff; }

.home-config-group { background: var(--panel-low); }
.home-config-group > summary,
.source-data-group > summary,
.detail-data-summary { border-color: var(--line); }
.dimension-card,
.keyword-preview-row,
.source-toggle-row,
.dimension-value-form { background: var(--panel); border-color: var(--line); }
.table-head { background: var(--panel-low); }
.table-row, .rank-row, .table-head { border-color: var(--line); border-radius: 3px; }
.source-post-card { border-left: 2px solid var(--line-strong); background: var(--panel-raised); }
.source-post-card:hover { border-left-color: var(--accent-strong); }
.source-tags span { background: var(--panel-low); color: var(--accent-strong); border-color: var(--line); }
.source-post-tags span { background: var(--panel-low); color: var(--muted); }
.thumb-button { background: var(--panel-low); }
.thumb-button b { background: var(--coral); color: #fff; }
.analysis-box, .raw-data-box, .post-text-details { border-color: var(--line); background: var(--panel-low); }
.analysis-box pre, .raw-data-box pre, .compact-details pre, .detail-box { background: var(--panel-low); color: var(--ink); }
:root[data-theme="dark"] .image-missing,
:root[data-theme="dark"] .thumb-button,
:root[data-theme="dark"] .keyword-edit-panel,
:root[data-theme="dark"] .keyword-inline-form.is-editing input,
:root[data-theme="dark"] .keyword-inline-form.is-editing select { background: var(--panel-low); color: var(--ink); }

.modal-backdrop,
.image-modal,
.post-modal,
.scan-modal,
.run-modal { background: rgba(0, 0, 0, .76); backdrop-filter: blur(8px); }
.settings-modal,
.post-modal article,
.scan-modal article,
.run-modal article,
.image-modal figure {
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel-raised);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .5);
}
.settings-header,
.settings-tabs { background: var(--panel-low); border-color: var(--line); }
.settings-tabs button { color: var(--muted); }
.settings-tabs button.is-active { background: var(--accent); color: #071007; }
:root[data-theme="light"] .settings-tabs button.is-active { color: #fff; }
:root[data-theme="light"] .settings-tabs button:not(.is-active) { background: var(--panel-raised); color: var(--muted); }
:root[data-theme="light"] .settings-header .icon-button { color: var(--ink); }
.settings-content { background: var(--panel-raised); }
.chart-card svg text { fill: var(--muted); }

.login-body { background: var(--bg); }
.auth-shell { filter: drop-shadow(0 24px 60px var(--shadow)); }
.auth-brand, .auth-notice { filter: none; }
.notice { border-color: var(--coral); background: var(--panel-low); color: var(--coral); }

[data-start-scan]:not(:disabled) { animation: terminal-pulse 2.4s ease-in-out infinite; }
@keyframes terminal-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

@media (max-width: 1040px) {
  .topbar { grid-template-columns: minmax(140px, .7fr) minmax(220px, 1.2fr) auto; }
  .top-actions .pill { display: none; }
  .trend-intelligence-layout { grid-template-columns: minmax(0, 1fr) 178px; }
}

@media (max-width: 760px) {
  .login-body { place-items: start center; padding: 20px 12px; }
  .auth-shell { gap: 16px; }
  .auth-brand h1 { font-size: 32px; }
  .auth-grid { grid-template-columns: 1fr; }
  .auth-panel { min-height: 0; padding: 18px; }
  .topbar { position: relative; grid-template-columns: 1fr auto; min-height: 52px; padding: 8px 10px; }
  .topbar > .brand-lockup { align-self: center; }
  .brand-mark { flex-basis: 25px; width: 25px; height: 25px; }
  .topbar .eyebrow { display: none; }
  .topbar h1 { font-size: 18px; }
  .site-intro { grid-column: 1 / -1; grid-row: 2; font-size: 10px; line-height: 1.3; }
  .top-actions { grid-column: 2; grid-row: 1; width: auto; flex-wrap: nowrap; justify-content: end; }
  .top-actions .compact-action { min-width: 34px; width: 34px; padding: 0 4px; overflow: hidden; }
  .top-actions form:last-child { display: flex; }
  .top-actions form:last-child .compact-action { width: auto; min-width: 38px; }
  .shell { width: min(100% - 16px, 1520px); margin-top: 8px; }
  .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-strip div { min-height: 46px; }
  .panel { padding: 9px; }
  .trend-intelligence-layout { grid-template-columns: minmax(0, 1fr); }
  .trend-category-grid { grid-template-columns: repeat(8, minmax(138px, 1fr)); }
  .evidence-rail { border-top-width: 1px; }
  .evidence-filmstrip { grid-auto-flow: column; grid-auto-columns: 144px; grid-template-rows: 70px; max-height: none; overflow-x: auto; overflow-y: hidden; }
  .evidence-filmstrip button { height: 70px; }
  .cross-result-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); overflow-x: auto; }
  .settings-modal { border-radius: 0; }
}
