:root {
  color-scheme: light;
  --page: #f6f8fc;
  --surface: #ffffff;
  --soft: #f4f7ff;
  --line: #e5ebf5;
  --line-strong: #d8e1ef;
  --ink: #17213a;
  --muted: #67728a;
  --blue: #2563eb;
  --blue-soft: #edf3ff;
  --green: #19b66a;
  --green-soft: #dcfce9;
  --red: #ef4444;
  --red-soft: #fee5e5;
  --purple: #7c5cf6;
  --purple-soft: #f0eaff;
  --amber: #f59e0b;
  --amber-soft: #fff4dc;
  --shadow: 0 12px 34px rgba(22, 34, 58, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-header {
  height: 72px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  align-items: center;
  gap: 22px;
  box-shadow: 0 1px 16px rgba(22, 34, 58, 0.04);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-button,
.table-action,
.page-step,
.page-number,
.dots-button {
  border: 1px solid transparent;
  background: transparent;
  color: #19325f;
  cursor: pointer;
}

.nav-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
}

.brand {
  flex: 1;
  display: grid;
  gap: 2px;
}

.brand > span {
  color: #31507d;
  font-size: 12px;
  font-weight: 800;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.15;
}

h2 {
  font-size: 14px;
  line-height: 1.2;
}

.info-dot {
  width: 16px;
  height: 16px;
  border: 2px solid #31405d;
  border-radius: 50%;
  color: #31405d;
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
}

.table-action:hover,
.page-step:hover,
.page-number:hover,
.dots-button:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

.shell {
  width: min(1450px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.45fr) repeat(5, minmax(126px, 1fr)) auto auto auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
}

label {
  min-width: 0;
  display: grid;
  gap: 7px;
}

label span {
  color: #415477;
  font-size: 11px;
  font-weight: 850;
}

.input-shell {
  position: relative;
}

.input-shell svg {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c7892;
  width: 16px;
  height: 16px;
}

input,
select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 13px;
  outline: none;
  font-size: 13px;
}

input {
  padding-right: 40px;
}

input:focus,
select:focus {
  border-color: #4f73ff;
  box-shadow: 0 0 0 3px rgba(79, 115, 255, 0.14);
}

.clear-button,
.review-button,
.mini-select,
.view-more {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.clear-button {
  height: 44px;
  padding: 0 12px;
  color: #3c4b66;
  font-size: 13px;
}

.review-button {
  height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.24);
  white-space: nowrap;
}

.review-button.active {
  background: #143fbb;
}

.statement-toggle {
  background: #111b31;
  box-shadow: 0 10px 18px rgba(17, 27, 49, 0.18);
}

.statement-toggle.active {
  background: var(--amber);
  color: #111b31;
}

.review-button svg {
  width: 16px;
  height: 16px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.statement-segmentation {
  display: grid;
  grid-template-columns: minmax(230px, 330px) repeat(3, minmax(170px, 1fr));
  gap: 14px;
  align-items: stretch;
  padding: 18px;
  margin-bottom: 18px;
}

.statement-segmentation[hidden] {
  display: none;
}

.seg-card {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: #1e3155;
  cursor: pointer;
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 16px;
  text-align: left;
}

.seg-card:hover,
.seg-card.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.seg-card strong {
  color: #111b31;
  font-size: 26px;
  line-height: 1;
}

.seg-card span {
  color: #2d4368;
  font-size: 12px;
  font-weight: 900;
}

.seg-card small {
  color: #687792;
  font-size: 11px;
  font-weight: 750;
}

.reset-card.active {
  border-color: #111b31;
  background: #f1f4f9;
}

.correction-workbench {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  margin-bottom: 18px;
}

.workbench-copy {
  display: grid;
  gap: 6px;
}

.workbench-copy p {
  margin: 0;
  color: #5c6a84;
  font-size: 12px;
  line-height: 1.45;
}

.drop-lanes {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}

.drop-zone {
  min-height: 74px;
  border: 1px dashed #b9c7dc;
  border-radius: 8px;
  background: #fbfdff;
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 12px;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.drop-zone strong {
  color: #1d3156;
  font-size: 12px;
}

.drop-zone span {
  color: #687792;
  font-size: 11px;
  line-height: 1.3;
}

.drop-zone select {
  height: 34px;
  font-size: 12px;
}

.drop-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: translateY(-1px);
}

.drop-zone.drop-error {
  border-color: var(--red);
  background: var(--red-soft);
}

.dataset-link {
  min-height: 42px;
  border-radius: 8px;
  background: #111b31;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.kpi {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.cube,
.region-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

.open-icon {
  background: var(--red-soft);
  color: var(--red);
}

.closed-icon {
  background: var(--green-soft);
  color: var(--green);
}

.project-icon {
  background: var(--purple-soft);
  color: var(--purple);
}

.review-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.kpi div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.kpi span:not(.kpi-icon) {
  color: #405274;
  font-size: 12px;
  font-weight: 850;
}

.kpi strong {
  color: #111b31;
  font-size: 30px;
  line-height: 1;
}

.kpi small {
  color: #51617a;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 14px;
}

.keyword-panel,
.statement-panel {
  min-height: 700px;
  overflow: hidden;
}

.statement-panel {
  min-height: 420px;
}

.panel-head {
  min-height: 60px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-select {
  color: #34517c;
  font-size: 12px;
}

.mini-select::after,
.view-more::after {
  content: "v";
  margin-left: 8px;
  font-size: 11px;
}

.group-list {
  display: grid;
  gap: 4px;
  padding: 10px 8px;
}

.group-item {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
}

.group-item:hover,
.group-item.active {
  background: var(--soft);
}

.group-item.active {
  border-left-color: var(--blue);
}

.group-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
}

.group-icon svg {
  width: 15px;
  height: 15px;
}

.group-item > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.group-title {
  overflow: hidden;
  color: #1e3155;
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-meta {
  color: #6c7892;
  font-size: 11px;
  font-weight: 700;
}

.group-count {
  min-width: 28px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 8px;
  background: #eaf1ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
}

.view-more {
  display: block;
  margin: 14px auto 20px;
  color: #38537c;
  font-size: 12px;
}

.statement-list {
  display: grid;
  gap: 5px;
  padding: 10px 8px;
}

.statement-item {
  width: 100%;
  min-height: 78px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 10px 12px;
  text-align: left;
}

.statement-item:hover,
.statement-item.active {
  background: #fff8e8;
  border-color: #f5d590;
}

.statement-item.active {
  border-left-color: var(--amber);
}

.statement-title {
  max-height: 38px;
  overflow: hidden;
  color: #1e3155;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}

.statement-meta {
  color: #7a5b12;
  font-size: 11px;
  font-weight: 750;
}

.statement-item .group-count {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  background: #fff2ce;
  color: #a15c00;
}

.table-panel {
  min-height: 700px;
  overflow: hidden;
}

.table-head {
  padding-right: 18px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-actions > span {
  color: #415477;
  font-size: 12px;
  font-weight: 800;
  margin-right: 8px;
}

.table-action {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface);
}

.table-action svg {
  width: 16px;
  height: 16px;
}

.table-action.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.table-wrap {
  overflow: auto;
  min-height: 680px;
  max-height: 78vh;
}

table {
  width: 100%;
  min-width: 1620px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbfcff;
  color: #51617e;
  font-size: 11px;
  font-weight: 900;
}

td {
  color: #111b31;
  font-size: 12px;
  line-height: 1.48;
}

tbody tr:hover {
  background: #fbfdff;
}

tbody tr[draggable="true"] {
  cursor: grab;
}

tbody tr.dragging {
  opacity: 0.55;
}

.drag-preview {
  position: fixed;
  top: -1000px;
  left: -1000px;
  width: 360px;
  max-height: 150px;
  overflow: hidden;
  border: 1px solid #b9c7dc;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(22, 34, 58, 0.18);
  display: grid;
  gap: 6px;
  padding: 12px;
  color: #111b31;
}

.drag-preview strong {
  color: var(--blue);
  font-size: 12px;
}

.drag-preview span {
  font-size: 12px;
  line-height: 1.4;
}

.description {
  max-width: 360px;
}

.url-cell {
  min-width: 86px;
}

.issue-link {
  color: var(--blue);
  font-weight: 850;
  text-decoration: none;
}

.issue-link:hover {
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
}

.closed {
  background: var(--green-soft);
  color: #087c42;
}

.open {
  background: var(--red-soft);
  color: #c72727;
}

.ready {
  background: #e8f0ff;
  color: #2758ba;
}

.p1 {
  background: #fee2e2;
  color: #b91c1c;
}

.p2 {
  background: #fff1cf;
  color: #a15c00;
}

.p3 {
  background: #e4efff;
  color: #1d4fb7;
}

.neutral {
  background: #edf1f7;
  color: #51617e;
}

.corrected-stack {
  display: inline-grid;
  gap: 4px;
}

.corrected-stack small {
  color: #7a5b12;
  font-size: 10px;
  font-weight: 800;
}

.type-value {
  max-width: 190px;
}

.type-value > span {
  display: block;
}

.review-cell {
  width: 240px;
}

.review-stack {
  display: grid;
  gap: 8px;
}

.review-note {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #f1cc79;
  border-radius: 8px;
  background: #fff8e8;
}

.review-note strong {
  color: #b15c05;
  font-size: 11px;
  line-height: 1.35;
}

.review-note span {
  color: #6a5b3a;
  font-size: 11px;
  line-height: 1.35;
}

.row-actions {
  width: 44px;
  text-align: right;
}

.dots-button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #18345d;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
}

.table-footer {
  min-height: 62px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 142px;
  align-items: center;
  gap: 18px;
}

.table-footer > span {
  color: #52617a;
  font-size: 12px;
  font-weight: 750;
}

.pager,
.page-numbers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-step,
.page-number {
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #375074;
  font-size: 12px;
  font-weight: 850;
}

.page-number:disabled {
  background: var(--blue);
  color: #fff;
  cursor: default;
}

.page-step:disabled {
  color: #a6b0c3;
  cursor: default;
}

.page-gap {
  color: #72809a;
  font-size: 12px;
  font-weight: 850;
}

.page-size {
  height: 34px;
  font-size: 12px;
}

.empty-state {
  display: grid;
  gap: 5px;
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.loading .app-header {
  cursor: progress;
}

@media (max-width: 1280px) {
  .toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .search-field {
    grid-column: span 2;
  }

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

  .content-grid {
    grid-template-columns: 290px minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  .app-header {
    padding: 0 16px;
  }

  .shell {
    width: min(100% - 24px, 1450px);
  }

  .toolbar,
  .kpis,
  .statement-segmentation,
  .correction-workbench,
  .content-grid {
    grid-template-columns: 1fr;
  }

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

  .keyword-panel {
    min-height: auto;
  }

  .table-footer {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .drop-lanes {
    grid-template-columns: 1fr;
  }
}
