:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --line: #d8dee8;
  --text: #17202c;
  --muted: #697586;
  --accent: #1c6b4f;
  --accent-strong: #15543f;
  --warn: #b45f06;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 20px clamp(16px, 4vw, 48px);
}

.topbar h1 {
  font-size: 24px;
  line-height: 1.2;
  margin: 0 0 6px;
}

.homelink {
  color: inherit;
}

.homelink:hover {
  color: var(--accent);
  text-decoration: none;
}

.topbar p {
  color: var(--muted);
  margin: 0;
}

.targetchips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

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

.targetrow .targetchips {
  margin-top: 0;
}

.targetrowlabel {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  min-width: 34px;
}

.targetchip {
  align-items: center;
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
  min-height: 32px;
  padding: 3px 10px 3px 4px;
}

.targetchip:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.targeticon {
  align-items: center;
  background: var(--accent);
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  height: 24px;
  justify-content: center;
  line-height: 1;
  width: 24px;
}

.actions {
  align-items: center;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

button,
.button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  min-height: 40px;
  padding: 0 14px;
}

.button:hover {
  text-decoration: none;
}

.small {
  font-size: 13px;
  min-height: 32px;
  padding: 0 10px;
}

.secondary {
  background: #fff;
  color: var(--accent-strong);
}

.danger {
  background: #b42318;
  border-color: #b42318;
}

.danger:hover {
  background: #912018;
  border-color: #912018;
}

.disabled {
  background: #eef3f7;
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
}

.layout {
  margin: 0 auto;
  max-width: 1100px;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
}

.narrow {
  max-width: 760px;
}

.filterbar,
.settings {
  align-items: end;
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

label span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}

select,
input {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 0 12px;
}

.checkline {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  min-height: 40px;
}

.checkline input {
  min-height: auto;
  padding: 0;
}

.checkline span {
  color: var(--text);
  margin-bottom: 0;
}

.status {
  color: var(--muted);
  font-size: 14px;
  margin: 12px 0 16px;
}

.sitefilter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 14px;
}

.sitefilterbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.sitefilterbar strong {
  margin-right: 8px;
}

.sitechecks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sitecheck {
  align-items: center;
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
}

.sitecheck input {
  min-height: auto;
  padding: 0;
}

.sitecheck span {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.warning {
  color: var(--warn);
  font-weight: 700;
  margin-left: 8px;
}

.tablewrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 18px;
}

.debugpanel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 28px;
  overflow: hidden;
}

.debugheader {
  align-items: center;
  background: #eef3f7;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.debugheader h2 {
  font-size: 16px;
  margin: 0;
}

.debugheader span,
.debugempty {
  color: var(--muted);
  font-size: 13px;
}

.debugsummary {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  margin: 0;
}

.debugsummary div {
  background: #fff;
  padding: 14px 16px;
}

.debugsummary dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.debugsummary dd {
  font-weight: 700;
  margin: 0;
}

.debugerrors {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
}

.debugerrors ul {
  color: var(--warn);
  margin: 8px 0 0;
  padding-left: 18px;
}

.debugtable {
  border-top: 1px solid var(--line);
  overflow: auto;
}

.debugtable table {
  min-width: 860px;
}

.debugbadge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 9px;
}

.debugbadge.ok {
  background: #e9f6ef;
  color: #17603b;
}

.debugbadge.error {
  background: #fff1e6;
  color: var(--warn);
}

.debugbadge.warning {
  background: #fff7d6;
  color: #8a5a00;
}

.debugempty {
  margin: 0;
  padding: 16px;
}

.pageinfo {
  color: var(--muted);
  font-weight: 700;
  min-width: 80px;
  text-align: center;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #eef3f7;
  color: #344054;
  font-size: 13px;
}

td:first-child,
td:last-child {
  white-space: nowrap;
  width: 132px;
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  color: var(--muted);
  padding: 36px 16px;
  text-align: center;
}

.targetlist {
  margin-top: 28px;
}

.targetlist h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

.targetlist article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: 120px 100px 1fr;
  margin-bottom: 8px;
  padding: 14px;
}

.popup {
  background: #fff;
  height: 100vh;
  overflow: hidden;
}

.popupbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 56px;
  justify-content: space-between;
  padding: 8px 12px;
}

.popupbar span {
  color: var(--muted);
  margin-left: 10px;
}

iframe {
  border: 0;
  height: calc(100vh - 56px);
  width: 100%;
}

@media (max-width: 720px) {
  .topbar,
  .filterbar,
  .settings {
    align-items: stretch;
    flex-direction: column;
  }

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

  .targetlist article {
    grid-template-columns: 1fr;
  }

  .debugheader {
    align-items: flex-start;
    flex-direction: column;
  }

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