:root {
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f8fafc;
  --card: #ffffff;
  --hover: #e8f2ff;
  --pjm-bg: #d9efe0;
  --pjm-text: #1f6b3a;
  --accent: #2563eb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
}
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
.sub { margin: 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 8px; }

.chips { display: flex; gap: 8px; margin-bottom: 12px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 10px 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.chip-x { color: var(--muted); font-size: 14px; line-height: 1; }
.chip:hover { background: #f3f4f6; }

body.embed { background: #fff; }
body.embed .shell { padding: 12px 12px 16px; max-width: none; }
body.embed #chrome { display: none; }

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
input, select, .btn {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
}
input, select { padding: 9px 10px; font-weight: 500; }
.btn {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.btn:hover { background: #f3f4f6; }
.btn.primary { background: #111827; color: white; border-color: #111827; }
.btn.primary:hover { background: #000; }
.btn:disabled { opacity: 0.45; cursor: default; }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  min-height: 420px;
}
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td {
  text-align: left;
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #fafafa;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
}
th:hover { color: var(--text); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--hover); }
.badge {
  display: inline-block;
  background: var(--pjm-bg);
  color: var(--pjm-text);
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}
.pager-btns { display: flex; gap: 8px; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100%;
  background: white;
  box-shadow: -12px 0 40px rgba(0,0,0,0.12);
  z-index: 2;
  overflow: auto;
}
.drawer-inner { padding: 22px; }
.drawer-close {
  float: right;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}
.drawer h2 { margin: 8px 0 16px; font-size: 18px; }
dl { margin: 0; }
dt { color: var(--muted); font-size: 12px; font-weight: 700; margin-top: 12px; }
dd { margin: 4px 0 0; font-size: 14px; }

@media (max-width: 900px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .top { flex-direction: column; align-items: stretch; }
}
