:root {
  color-scheme: light;
  --ink: #182e45;
  --muted: #526779;
  --line: #cad5de;
  --head: #eff3f6;
  --blue: #165598;
}

* { box-sizing: border-box; }

body {
  width: min(1480px, 100%);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 24px clamp(12px, 3vw, 42px);
  margin: 0 auto;
  color: var(--ink);
  background: white;
  font: 15px/1.45 "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

main { display: flex; flex-direction: column; flex: 1; min-height: 0; }
main > :not(.grid) { flex: none; }
footer { flex: none; padding-top: 8px; text-align: right; }

.tools { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tools button {
  flex: none;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--blue);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}
.tools button:hover:enabled { background: var(--head); }
.tools button:disabled { color: var(--muted); cursor: wait; }
#notice p { margin: 0 0 9px; color: var(--muted); font-size: .86rem; }
#notice p:empty { display: none; }
#notice a { color: var(--blue); }
footer, .count { color: var(--muted); font-size: .84rem; }
.count { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
label { font-weight: 650; }

input {
  max-width: 630px;
  min-width: 0;
  flex: 1;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #9caebc;
  border-radius: 4px;
  color: var(--ink);
  font: inherit;
}

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.grid { min-height: 0; overflow: auto; overflow-anchor: none; border: 1px solid var(--line); }
table { width: 100%; min-width: 47rem; border-collapse: collapse; table-layout: fixed; }
.kind, .group { width: 11%; }
.code-col { width: 4.25rem; }
.name { width: 21%; }
.type-col { width: 9%; }

td, th {
  padding: 5px 10px;
  text-align: left;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

td, tbody th { border-top: 1px solid var(--line); font-size: .92rem; vertical-align: middle; }
tr > * + * { border-left: 1px solid var(--line); }
thead { position: sticky; top: 0; z-index: 1; background: var(--head); box-shadow: 0 1px 0 var(--line); }
thead th { padding: 0; background: var(--head); color: #3c5267; font-size: .83rem; font-weight: 700; }
thead button {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 32px;
  padding: 5px 9px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
thead button:hover, thead button:focus-visible { background: #e1e9ef; }
thead button:focus-visible { outline-offset: -2px; }
th[aria-sort] button { color: var(--blue); }
.sort-icon { display: grid; gap: 2px; color: var(--muted); }
.sort-icon::before, .sort-icon::after {
  content: "";
  width: 0;
  height: 0;
  border-inline: 3px solid transparent;
}
.sort-icon::before { border-bottom: 4px solid currentColor; }
.sort-icon::after { border-top: 4px solid currentColor; }
th[aria-sort] .sort-icon { color: inherit; }
[aria-sort="ascending"] .sort-icon::after, [aria-sort="descending"] .sort-icon::before { display: none; }
tbody th { font-weight: 550; }
.code, .type, .value-code { font-family: Consolas, "SFMono-Regular", monospace; font-variant-numeric: tabular-nums; }
.code { color: #264564; }
.type { color: var(--muted); font-size: .86rem; }
.value-code { color: #44596d; }
.detail { display: block; }
.secondary { display: block; margin-top: 3px; white-space: pre-line; color: var(--muted); font-size: .82rem; font-weight: 400; }
.source {
  display: inline-block;
  white-space: nowrap;
  padding: 0 .32em;
  border-radius: 3px;
  font: 600 .69rem/1.55 system-ui, sans-serif;
  vertical-align: baseline;
}
.source-nk { color: #16603d; background: #e7f4ed; }
.source-my { color: #195992; background: #eaf2fa; }
.source-asp { color: #902d41; background: #fbeef0; }
td ul { list-style: none; padding: 0; margin: 0; }
td li { line-height: 1.4; }
mark { background: #d6e9ff; color: #103e76; border-radius: 2px; }
.empty { padding: 22px 8px; color: var(--muted); text-align: center; }
.catalog-spacer td { border: 0; padding: 0; line-height: 0; }

@media (max-width: 600px) {
  body { padding: 14px 10px; }
  .tools { gap: 7px; }
  footer, .count { font-size: .75rem; }
  input { font-size: 16px; }
  td, tbody th, thead button { padding-inline: 7px; }
}

@media (max-width: 420px) {
  .tools { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; row-gap: 3px; }
  .count { grid-column: 1 / -1; justify-self: end; }
}

@media print {
  body { display: block; height: auto; padding: 0; }
  main { display: block; }
  .grid { overflow: visible; }
  table { min-width: 0; }
  thead { position: static; box-shadow: none; }
}
