:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #d9e2ef;
  --text: #182235;
  --muted: #66758c;
  --primary: #1769e0;
  --primary-dark: #0c54ba;
  --chip: #eef4ff;
  --good: #0b7a4b;
  --warn: #9a5b00;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
}
.brand-title { font-size: 17px; font-weight: 800; }
.brand-subtitle { font-size: 12px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; }

button, input, select {
  font: inherit;
}
button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 7px;
  padding: 9px 12px;
  cursor: pointer;
}
button:hover { border-color: #a7bdd9; }
.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.primary:hover { background: var(--primary-dark); }
.ghost { background: #fff; }
.wide { width: 100%; margin-top: 8px; }
.icon-btn { min-width: 54px; background: var(--primary); color: #fff; border-color: var(--primary); }

.layout {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: 300px minmax(600px, 1fr) 360px;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcff;
  padding: 18px;
  overflow: auto;
}
.content {
  padding: 18px 22px;
  overflow: auto;
}
.detail {
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
  overflow: auto;
  position: relative;
}

label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 9px 10px;
  min-height: 38px;
}
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.search-block, .filter-group { margin-bottom: 14px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat strong { display: block; font-size: 24px; margin-top: 5px; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}
h1 { margin: 0 0 4px; font-size: 24px; }
p { margin: 0; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 8px; }

.notice {
  display: none;
  border: 1px solid #ffd58a;
  background: #fff8e8;
  color: var(--warn);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.notice.show { display: block; }

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}
th {
  color: var(--muted);
  background: #f8fbff;
  font-weight: 800;
}
tr:hover td { background: #f9fbff; }
.creator-name { font-weight: 800; overflow-wrap: anywhere; }
.creator-handle { color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.chip {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--chip);
  color: #24528f;
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.score { font-weight: 800; color: var(--good); }
.muted { color: var(--muted); }
.open-link { color: var(--primary); text-decoration: none; font-weight: 800; }

.close {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
}
.detail-card h2 { margin: 0 36px 8px 0; font-size: 21px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.detail-section { margin-top: 16px; }
.detail-section h3 { font-size: 13px; color: var(--muted); margin: 0 0 7px; text-transform: uppercase; }
.evidence {
  border: 1px solid var(--line);
  background: #f8fbff;
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.detail-empty {
  color: var(--muted);
  line-height: 1.5;
  padding-top: 44px;
}

dialog {
  border: none;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(18, 32, 56, 0.26);
}
.dialog-card {
  width: 420px;
  padding: 22px;
  background: #fff;
}
.dialog-card h2 { margin: 0 0 8px; }
.dialog-card input { margin-bottom: 12px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 8px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 280px minmax(0, 1fr); }
  .detail {
    position: fixed;
    right: 0;
    top: 64px;
    bottom: 0;
    width: min(420px, 92vw);
    transform: translateX(100%);
    transition: transform .16s ease;
    z-index: 30;
  }
  .detail.open { transform: translateX(0); }
}

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 64px; flex-wrap: wrap; gap: 10px; padding: 12px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); }
  .stats { grid-template-columns: 1fr 1fr; }
  .toolbar { align-items: start; flex-direction: column; }
  table { min-width: 820px; }
  .table-wrap { overflow-x: auto; }
}
