:root {
  color-scheme: light;
  --ink: #122033;
  --muted: #5d6f82;
  --paper: #f3f7f4;
  --panel: rgba(255, 255, 255, 0.94);
  --line: rgba(18, 32, 51, 0.12);
  --teal: #0f766e;
  --teal-deep: #0b5f59;
  --amber: #c47a12;
  --up: #c62828;
  --down: #1b7f4a;
  --flat: #5d6f82;
  --shadow: 0 10px 28px rgba(18, 40, 48, 0.08);
  --font: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(circle at 12% 8%, rgba(15, 118, 110, 0.14), transparent 32%),
    radial-gradient(circle at 88% 0%, rgba(196, 122, 18, 0.1), transparent 24%),
    linear-gradient(180deg, #e8f1ec 0%, var(--paper) 42%, #eef3f0 100%);
}

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

button {
  border: 0;
  cursor: pointer;
}

.page {
  width: min(1080px, calc(100% - 20px));
  margin: 0 auto;
  padding: 16px 0 28px;
}

.hero {
  margin-bottom: 10px;
}

.brand {
  margin: 0;
  color: var(--teal);
  font-size: clamp(22px, 3.5vw, 28px);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.lede {
  max-width: none;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.panel {
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

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

.meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfffd;
  color: var(--ink);
  padding: 8px 10px;
  line-height: 1.45;
  font-size: 13px;
  outline: 0;
}

textarea:focus,
select:focus {
  border-color: rgba(15, 118, 110, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.sort-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select {
  min-width: 180px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.primary-btn,
.ghost-btn {
  height: 34px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #fff;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.18);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ghost-btn {
  background: #e7f2ef;
  color: var(--teal-deep);
}

.ghost-btn.danger {
  background: #fdecec;
  color: #b42318;
}

.status {
  min-height: 18px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.status.is-busy {
  color: var(--amber);
}

.status.is-error {
  color: #b42318;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 420px;
}

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

th,
td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(18, 32, 51, 0.08);
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #edf5f2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  user-select: none;
}

th.is-active {
  color: var(--teal-deep);
}

th.is-active::after {
  content: attr(data-arrow);
  margin-left: 4px;
}

td {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

tbody tr:hover td {
  background: rgba(15, 118, 110, 0.04);
}

.empty-row td {
  color: var(--muted);
  text-align: center;
  font-weight: 500;
  white-space: normal;
  padding: 16px 10px;
}

.author-cell,
.raw-cell {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.change-up {
  color: var(--up);
}

.change-down {
  color: var(--down);
}

.change-flat {
  color: var(--flat);
}

.code-pill {
  display: inline-block;
  border-radius: 999px;
  background: #eef4f1;
  padding: 2px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

#unmatchedList {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#unmatchedList li {
  border-radius: 8px;
  background: #fff7ed;
  padding: 7px 10px;
  color: #9a3412;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.foot {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.advice-disclaimer {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.advice-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 14px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.focus-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfffd;
  padding: 10px;
}

.focus-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.focus-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.focus-code {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.focus-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 6px;
}

.tag {
  border-radius: 999px;
  background: #e7f2ef;
  color: var(--teal-deep);
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
}

.tag.warn {
  background: #fff4e5;
  color: #9a5b00;
}

.tag.risk {
  background: #fdecec;
  color: #b42318;
}

.focus-reasons {
  margin: 0;
  padding-left: 16px;
  color: #314255;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.focus-reasons li + li {
  margin-top: 2px;
}

.caution-block,
.advice-method {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.caution-block h3,
.advice-method h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
}

.caution-block ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.caution-block li {
  border-radius: 8px;
  background: #fff7ed;
  padding: 7px 10px;
  color: #9a3412;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.advice-method p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 12px, 1080px);
    padding-top: 12px;
  }

  .panel-head,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .head-actions {
    justify-content: flex-start;
  }

  select,
  .primary-btn {
    width: 100%;
  }

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