:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #1d2522;
  --muted: #68736f;
  --line: #d9ded9;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --amber: #a86412;
  --red: #b42318;
  --green: #177245;
  --blue: #234f83;
  --shadow: 0 1px 2px rgba(20, 30, 28, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

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

a:hover {
  text-decoration: underline;
}

button,
.primary-action,
.secondary-action {
  min-height: 38px;
  border: 1px solid var(--teal-dark);
  border-radius: 8px;
  padding: 8px 14px;
  background: var(--teal);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary-action {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 800;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(170px, 220px) 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 58px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

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

.nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav a {
  min-height: 34px;
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--muted);
  font-weight: 750;
}

.nav a.active,
.nav a:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.userbar {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.userbar span {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.notice {
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
}

.notice.error {
  border: 1px solid rgba(180, 35, 24, 0.35);
  background: #fff1ef;
  color: var(--red);
}

.page-head {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 22px;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: end;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric,
.panel,
.detail-block,
.profile-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 94px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric strong {
  font-size: 32px;
  line-height: 1;
}

.split-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-head,
.profile-card-head {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  min-height: 54px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

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

th {
  background: #f8faf8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

td {
  max-width: 420px;
}

tbody tr:hover {
  background: #fbfcfb;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 850;
}

.status.accepted {
  background: #e8f4ee;
  color: var(--green);
}

.status.duplicate {
  background: #fff4e6;
  color: var(--amber);
}

.status.invalid {
  background: #fff1ef;
  color: var(--red);
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filters .wide {
  grid-column: span 2;
}

.url-cell {
  white-space: nowrap;
}

.pager {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
}

.pager a {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  background: #ffffff;
  font-weight: 750;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.detail-block {
  padding: 16px;
}

dl {
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
  gap: 10px 14px;
  margin: 16px 0 0;
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.long-text {
  margin: 0;
  padding: 16px;
  font-size: 17px;
}

pre {
  max-height: 420px;
  margin: 0;
  overflow: auto;
  padding: 16px;
  background: #111817;
  color: #ecf5f1;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.stack-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px 16px 16px 34px;
}

.profile-insights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.profile-card {
  overflow: hidden;
}

.profile-card-head strong {
  color: var(--blue);
  font-size: 24px;
}

.profile-card dl {
  padding: 0 16px 16px;
}

.samples {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.samples p {
  margin: 0;
  border-left: 3px solid var(--teal);
  padding-left: 10px;
  color: #38423f;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: start;
    padding: 12px 16px;
  }

  .nav,
  .userbar {
    flex-wrap: wrap;
  }

  .shell {
    padding: 22px 16px 36px;
  }

  .page-head,
  .inline-form {
    display: grid;
    align-items: stretch;
  }

  .metric-grid,
  .split-layout,
  .detail-grid,
  .profile-insights {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  h1 {
    font-size: 24px;
  }

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

  .filters .wide {
    grid-column: span 1;
  }

  dl {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
