/* 关键词调研（Keyword Lab）。视觉沿用项目台既有语言：白卡 + 品红重点色 + 紧凑数据表，
   只补本模块自己的排布与徽章，不覆盖 styles.css 里的通用类。 */
#kwlab-root {min-width:0;}
.kwl-root {min-width:0;}
.kwl-intro {gap:18px;}
.kwl-client-label {flex-shrink:0;border:1px solid var(--border);border-radius:30px;padding:8px 14px;color:var(--ink-soft);font-size:12px;white-space:nowrap;}

.kwl-steps {display:flex;gap:6px;margin:14px 0 12px;overflow-x:auto;border-bottom:1px solid var(--border);}
.kwl-steps button {display:flex;align-items:center;gap:7px;padding:11px 15px;border:0;border-bottom:3px solid transparent;background:transparent;font:inherit;font-size:12px;color:var(--ink-faint);white-space:nowrap;}
.kwl-steps button b {display:grid;place-items:center;width:18px;height:18px;border-radius:50%;background:var(--border);color:var(--white);font:700 10px/1 var(--font-data);}
.kwl-steps button[aria-pressed="true"] {border-bottom-color:var(--magenta);color:var(--ink);font-weight:650;}
.kwl-steps button[aria-pressed="true"] b {background:var(--magenta);}
.kwl-steps button:disabled {opacity:.45;}
.kwl-step-count {font:600 10px/1 var(--font-data);color:var(--ink-faint);}

.kwl-error {padding:13px 16px;margin-bottom:14px;border:1px solid #e7bfc1;border-radius:var(--radius-sm);background:var(--red-pale);color:var(--red);font-size:12px;line-height:1.7;overflow-wrap:anywhere;}
.kwl-conflict {display:flex;align-items:center;gap:12px;padding:12px 16px;margin-bottom:14px;border:1px solid #e4c79a;border-radius:var(--radius-sm);background:var(--amber-pale);color:var(--amber);font-size:12px;}
.kwl-conflict .button {margin-left:auto;flex-shrink:0;}
.kwl-error[hidden],.kwl-conflict[hidden],.kwl-progress[hidden],.kwl-warn[hidden],.kwl-quota[hidden],.kwl-panel[hidden] {display:none;}

.kwl-progress {padding:14px 16px;margin-bottom:14px;border:1px solid var(--border);border-left:3px solid var(--magenta);border-radius:var(--radius-sm);background:var(--white);}
.kwl-progress > div {display:flex;align-items:center;gap:9px;font-size:12px;}
.kwl-progress > div > span:last-child {margin-left:auto;color:var(--ink-faint);font-size:11px;}
.kwl-progress p {margin:7px 0 9px;color:var(--ink-faint);font-size:11px;line-height:1.7;}
.kwl-progress progress {width:100%;height:5px;border:0;border-radius:99px;background:var(--canvas);appearance:none;}
.kwl-progress progress::-webkit-progress-bar {background:var(--canvas);border-radius:99px;}
.kwl-progress progress::-webkit-progress-value {background:var(--magenta);border-radius:99px;}
.kwl-dot {width:7px;height:7px;border-radius:50%;background:var(--magenta);animation:kwl-pulse 1.1s ease-in-out infinite;}
@keyframes kwl-pulse {0%,100% {opacity:.3;} 50% {opacity:1;}}
@media (prefers-reduced-motion: reduce) {.kwl-dot {animation:none;}}

.kwl-status {min-height:22px;margin-bottom:12px;color:var(--ink-faint);font-size:12px;line-height:1.7;}
.kwl-note {margin:10px 0 0;color:var(--ink-faint);font-size:11px;line-height:1.8;}
.kwl-fineprint {color:var(--ink-faint);font-size:10px;line-height:1.7;}
.kwl-muted {color:var(--ink-faint);}
.kwl-danger {color:var(--red);}
.kwl-lead {margin:0 0 12px;font-size:12px;line-height:1.9;}
.kwl-list {margin:0 0 14px;padding-left:18px;font-size:12px;line-height:1.9;color:var(--ink-soft);}
.kwl-list li + li {margin-top:5px;}

.kwl-form,.kwl-card {padding:22px 24px;margin-bottom:16px;}
.kwl-card > .section-heading,.kwl-form > .section-heading {margin-bottom:2px;}
.kwl-card h3,.kwl-form h3 {margin:0;font-size:17px;font-weight:600;}
.kwl-saved,.kwl-scope {color:var(--ink-faint);font-size:11px;text-align:right;}
.kwl-grid {margin-top:16px;}
.kwl-grid textarea {min-height:74px;line-height:1.7;}
.kwl-warn {margin-top:14px;padding:11px 14px;border:1px solid #e4c79a;border-left:3px solid var(--amber);border-radius:var(--radius-xs);background:var(--amber-pale);color:#7a4a0d;font-size:11px;line-height:1.75;}
.kwl-warn p + p {margin-top:4px;}
.kwl-quota {display:flex;flex-wrap:wrap;align-items:baseline;gap:8px 14px;margin-top:12px;padding:11px 14px;border:1px solid var(--border);border-radius:var(--radius-xs);background:#fafafb;font-size:11px;}
.kwl-quota b {font-family:var(--font-data);color:var(--magenta);}
.kwl-quota small {color:var(--ink-faint);font-size:10px;}
.kwl-form-actions {display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:18px;padding-top:16px;border-top:1px solid var(--border);}
.kwl-form-actions .kwl-fineprint {flex:1;min-width:220px;}

.kwl-toolbar,.kwl-add-row {display:flex;flex-wrap:wrap;align-items:end;gap:10px;margin-top:16px;}
.kwl-add-row {padding-top:14px;border-top:1px dashed var(--border);}
.kwl-toolbar .field,.kwl-add-row .field {margin:0;min-width:130px;}
.kwl-field-grow {flex:1;min-width:200px;}
.kwl-toolbar .field input,.kwl-toolbar .field select,.kwl-add-row .field input,.kwl-add-row .field select {min-height:36px;height:36px;padding:7px 9px;font-size:12px;}
.kwl-toolbar > .button,.kwl-add-row > .button {min-height:36px;padding:8px 11px;font-size:11px;white-space:nowrap;}
.kwl-actions {display:flex;flex-wrap:wrap;align-items:center;gap:9px;margin-top:14px;}
.kwl-actions .button {min-height:36px;padding:8px 12px;font-size:11px;}
.kwl-actions .kwl-fineprint {flex:1;min-width:200px;}

.kwl-table-scroll {overflow:auto;max-height:620px;margin-top:14px;border:1px solid var(--border);border-radius:var(--radius-sm);}
.kwl-table {width:100%;}
.kwl-seed-table {min-width:980px;}
.kwl-pool-table {min-width:1020px;}
.kwl-coverage-table {min-width:820px;}
.kwl-table td {font-size:12px;vertical-align:top;}
.kwl-table td > strong {font-size:12px;font-weight:600;overflow-wrap:anywhere;}
.kwl-table td > small,.kwl-table td strong + small {display:block;margin-top:4px;color:var(--ink-faint);font-size:10px;line-height:1.6;overflow-wrap:anywhere;}
.kwl-table .kwl-right {text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap;}
.kwl-seed-table th:first-child,.kwl-seed-table td:first-child {width:36px;}
.kwl-seed-table th:nth-child(2),.kwl-seed-table td:nth-child(2) {min-width:190px;}
.kwl-pool-table th:first-child,.kwl-pool-table td:first-child {min-width:220px;}
.kwl-coverage-table th:first-child,.kwl-coverage-table td:first-child {min-width:210px;}
.kwl-coverage-table td:first-child > strong {display:block;font-family:var(--font-data);font-size:11px;overflow-wrap:normal;}
.kwl-table input[type="checkbox"] {width:15px;height:15px;accent-color:var(--magenta);}
.kwl-empty-cell {padding:44px 20px;color:var(--ink-faint);text-align:center;}
.kwl-term {width:100%;min-width:130px;min-height:32px;padding:6px 8px;border:1px solid transparent;border-radius:var(--radius-xs);background:transparent;font:inherit;font-size:12px;font-weight:600;}
.kwl-term:hover:not(:disabled) {border-color:var(--border);background:var(--white);}
.kwl-term:focus {border-color:var(--magenta);background:var(--white);outline:0;box-shadow:0 0 0 3px rgba(229,0,88,.09);}
.kwl-axis {min-height:30px;padding:4px 6px;border:1px solid var(--border);border-radius:var(--radius-xs);background:var(--white);font:inherit;font-size:11px;}
.kwl-reason {max-width:250px;color:var(--ink-soft);font-size:11px;line-height:1.7;}
.kwl-linkbtn {padding:4px 0;border:0;background:transparent;color:var(--magenta);font:inherit;font-size:11px;white-space:nowrap;}
.kwl-seed-table td:nth-child(3),.kwl-seed-table td:last-child {white-space:nowrap;}
.kwl-linkbtn:hover:not(:disabled) {text-decoration:underline;}
.kwl-pool-table tbody tr {cursor:pointer;}
.kwl-pool-table tbody tr:focus-visible {outline:2px solid var(--magenta);outline-offset:-2px;}
.kwl-coverage-table tr.kwl-truncated td:first-child {box-shadow:inset 3px 0 var(--red);}
.kwl-coverage-table tr.kwl-truncated td {background:#fffafa;}

.kwl-intent {display:inline-block;padding:3px 6px;border-radius:4px;background:var(--blue-pale);color:#415672;font-size:10px;font-weight:500;line-height:1.5;white-space:nowrap;}
.kwl-intent-commercial {background:var(--amber-pale);color:#825318;}
.kwl-intent-transactional {background:var(--green-pale);color:var(--green);}
.kwl-intent-navigational {background:var(--magenta-pale);color:var(--magenta-dark);}
.kwl-health {display:inline-block;padding:3px 7px;border-radius:99px;font-size:10px;font-weight:600;white-space:nowrap;}
.kwl-health-ok {background:var(--green-pale);color:var(--green);}
.kwl-health-warn {background:var(--amber-pale);color:var(--amber);}
.kwl-health-bad {background:var(--red-pale);color:var(--red);}
.kwl-health-none {background:#eeeff2;color:var(--ink-faint);}
.kwl-health-idle {background:var(--canvas);color:var(--ink-faint);border:1px dashed var(--border-strong);}

.kwl-decision-cell {min-width:150px;}
.kwl-badge {display:inline-block;margin:0 4px 3px 0;padding:3px 7px;border-radius:4px;font-size:10px;font-weight:650;white-space:nowrap;}
.kwl-badge-keep {background:var(--green-pale);color:var(--green);}
.kwl-badge-demote {background:var(--amber-pale);color:var(--amber);}
.kwl-badge-drop {background:#eeeff2;color:var(--ink-faint);}
.kwl-badge-review {background:var(--blue-pale);color:#415672;}
/* 三类“为什么被降级”必须一眼分得开：类目不符（紫）、SERP 失配（红实心）、SERP 灰区（灰虚线）。 */
.kwl-badge-cat {background:#efe8fb;color:#5b3a9e;}
.kwl-badge-serpbad {background:var(--red-pale);color:var(--red);box-shadow:inset 0 0 0 1px #e7bfc1;}
.kwl-badge-serpgray {background:var(--white);color:var(--ink-soft);box-shadow:inset 0 0 0 1px var(--border-strong);border-style:dashed;}
.kwl-badge-idle {background:var(--canvas);color:var(--ink-faint);}
.kwl-rule {display:block;margin-top:3px;color:var(--ink-faint);font-size:10px;line-height:1.6;}
.kwl-chip {display:inline-block;margin:0 4px 3px 0;padding:2px 6px;border:1px solid var(--border);border-radius:4px;color:var(--ink-soft);font:500 10px/1.6 var(--font-data);}
.kwl-sources {max-width:190px;}

/* 用每格自己的描边画分隔线，空出来的那一格才不会露出灰底 */
.kwl-decision-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(118px,1fr));gap:1px;margin-top:16px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--white);overflow:hidden;}
.kwl-decision-grid > div {padding:13px 15px;background:var(--white);box-shadow:0 0 0 1px var(--border);}
.kwl-decision-grid span {display:block;color:var(--ink-soft);font-size:10px;}
.kwl-decision-grid strong {display:block;margin-top:5px;font-family:var(--font-data);font-size:21px;font-weight:500;letter-spacing:-.04em;}

.kwl-pagination {display:flex;align-items:center;gap:8px;margin-top:12px;}
.kwl-pagination > span {margin-right:auto;color:var(--ink-faint);font-size:11px;font-variant-numeric:tabular-nums;}
.kwl-pagination .button {min-height:34px;padding:7px 11px;font-size:11px;}

.kwl-sticky {position:sticky;bottom:0;z-index:3;display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:13px 18px;border:1px solid #f1bed2;border-radius:var(--radius-sm);background:var(--magenta-pale);box-shadow:0 -6px 18px rgba(23,23,28,.06);}
.kwl-sticky > div {flex:1;min-width:210px;}
.kwl-sticky strong {display:block;font-size:13px;font-weight:650;}
.kwl-sticky span {display:block;margin-top:3px;color:var(--ink-soft);font-size:11px;line-height:1.6;}
.kwl-sticky .button {min-height:38px;white-space:nowrap;}

.kwl-dialog {width:min(680px,calc(100vw - 32px));max-width:none;max-height:88dvh;padding:0;margin:auto;border:1px solid var(--white);border-radius:15px;background:var(--white);box-shadow:var(--shadow-float);overflow:auto;color:var(--ink);font-family:var(--font-body);}
.kwl-dialog::backdrop {background:rgba(23,23,28,.42);}
.kwl-dialog header {display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;border-bottom:1px solid var(--border);}
.kwl-dialog header h3 {margin:0;font-size:19px;font-weight:600;letter-spacing:-.02em;}
.kwl-dialog footer {display:flex;align-items:center;justify-content:flex-end;gap:10px;padding:15px 24px;border-top:1px solid var(--border);background:#fafbfc;}
.kwl-dialog footer .kwl-fineprint {margin-right:auto;max-width:290px;}
.kwl-dialog-body {padding:20px 24px;}
.kwl-dialog-body .kwl-table {margin-top:4px;}
.kwl-icon {display:grid;place-items:center;width:30px;height:30px;border:1px solid var(--border);border-radius:8px;background:var(--white);font-size:16px;line-height:1;color:var(--ink-soft);}
.kwl-log-head {display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:12px;margin-bottom:16px;padding:13px 15px;border:1px solid var(--border);border-left:3px solid var(--magenta);border-radius:var(--radius-xs);background:#fffafb;}
.kwl-log-head span {display:block;color:var(--ink-soft);font-size:10px;}
.kwl-log-head strong {display:block;margin-top:5px;font-size:13px;font-weight:600;}
.kwl-kv {display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:1px;margin-bottom:16px;border:1px solid var(--border);border-radius:var(--radius-xs);background:var(--border);overflow:hidden;}
.kwl-kv > div {padding:11px 13px;background:var(--white);}
.kwl-kv span {display:block;color:var(--ink-soft);font-size:10px;}
.kwl-kv strong {display:block;margin-top:4px;font-family:var(--font-data);font-size:16px;font-weight:500;}
.kwl-evidence {margin-top:14px;border:1px solid var(--border);border-radius:var(--radius-xs);}
.kwl-evidence summary {padding:10px 13px;font-size:11px;font-weight:600;cursor:pointer;}
.kwl-evidence pre {max-height:280px;margin:0;padding:12px 13px;border-top:1px solid var(--border);overflow:auto;background:#fafafb;font:10px/1.7 var(--font-data);white-space:pre-wrap;overflow-wrap:anywhere;}

#kwlab-root button:focus-visible,#kwlab-root input:focus-visible,#kwlab-root select:focus-visible,#kwlab-root textarea:focus-visible {outline:2px solid var(--magenta);outline-offset:2px;}

@media (max-width:900px) {
  .kwl-form,.kwl-card {padding:18px 16px;}
  .kwl-grid {grid-template-columns:1fr;}
  .kwl-intro {flex-direction:column;align-items:start;}
  .kwl-client-label {max-width:100%;white-space:normal;}
}
@media (max-width:560px) {
  .kwl-toolbar .field,.kwl-add-row .field {min-width:100%;}
  .kwl-toolbar > .button,.kwl-add-row > .button {width:100%;}
  .kwl-sticky {padding:12px 14px;}
  .kwl-sticky .button {width:100%;}
  .kwl-decision-grid {grid-template-columns:1fr 1fr;}
}
