:root {
    color-scheme: dark;
    --bg: #09100f;
    --surface: #0f1816;
    --surface-2: #14211e;
    --line: #263631;
    --text: #e8f0ed;
    --muted: #91a39d;
    --accent: #62e6bc;
    --accent-ink: #05110d;
    --danger: #ff8a8a;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
html { background: var(--bg); }
body { min-width: 320px; margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: .22em; }
a:hover { color: var(--accent); }
button, input, select { font: inherit; }
button, input, select { min-height: 44px; border-radius: 6px; }
button { border: 0; padding: .7rem 1rem; background: var(--accent); color: var(--accent-ink); font-weight: 800; cursor: pointer; }
button:hover { filter: brightness(1.08); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 72%, white); outline-offset: 3px; }

.topbar { position: sticky; top: 0; z-index: 10; min-height: 64px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: 0 clamp(1rem, 3vw, 3rem); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); }
.brand { justify-self: start; display: inline-flex; align-items: center; gap: .7rem; font-weight: 900; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { width: 2.1rem; height: 2.1rem; display: inline-grid; place-items: center; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-weight: 950; }
.topbar nav { display: flex; align-self: stretch; gap: 1.4rem; }
.topbar nav a { position: relative; display: grid; place-items: center; color: var(--muted); text-decoration: none; font-weight: 700; }
.topbar nav a[aria-current="page"] { color: var(--text); }
.topbar nav a[aria-current="page"]::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--accent); transform-origin: left; animation: underline-in .35s ease-out both; }
.topbar form { justify-self: end; }
.text-button { min-height: 38px; padding: .4rem .65rem; background: transparent; color: var(--muted); }

.workspace { width: min(1500px, 100%); margin: 0 auto; padding: clamp(1.5rem, 4vw, 4rem) clamp(1rem, 3vw, 3rem) 5rem; }
.catalog-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding-bottom: clamp(1.5rem, 3vw, 2.8rem); border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 .45rem; color: var(--accent); font-size: .76rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2.4rem, 7vw, 5.8rem); line-height: .9; letter-spacing: -.065em; }
.catalog-status { display: flex; gap: clamp(1rem, 4vw, 3rem); margin: 0; }
.catalog-status div { min-width: 6rem; }
.catalog-status dt, .profile-metrics dt, .profile-details dt { color: var(--muted); font-size: .78rem; }
.catalog-status dd { margin: .15rem 0 0; font-size: 1.15rem; font-weight: 850; }

.filters { max-width: 900px; margin: 2.2rem 0 .7rem; }
.filters label { display: block; margin-bottom: .5rem; color: var(--muted); font-size: .82rem; font-weight: 700; }
.filter-row { display: grid; grid-template-columns: minmax(220px, 1fr) 145px auto; gap: .6rem; }
input, select { width: 100%; border: 1px solid var(--line); padding: .65rem .8rem; background: var(--surface); color: var(--text); }
.result-count { margin: 0 0 1rem; color: var(--muted); font-size: .82rem; }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { padding: .85rem .75rem; color: var(--muted); font-size: .7rem; letter-spacing: .055em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: .88rem .75rem; border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent); vertical-align: middle; white-space: nowrap; }
tbody tr { opacity: 0; animation: row-in .28s ease-out forwards; transition: background-color .18s ease, transform .18s ease; }
tbody tr:nth-child(2) { animation-delay: .025s; } tbody tr:nth-child(3) { animation-delay: .05s; } tbody tr:nth-child(4) { animation-delay: .075s; } tbody tr:nth-child(5) { animation-delay: .1s; }
tbody tr:hover { background: var(--surface); }
.identity { display: inline-flex; align-items: center; gap: .7rem; min-width: 210px; text-decoration: none; }
.identity img, .avatar-fallback { width: 2.5rem; height: 2.5rem; border-radius: 7px; object-fit: cover; background: var(--surface-2); }
.avatar-fallback { display: grid; place-items: center; color: var(--muted); font-size: .72rem; }
.identity strong, .identity small, .clan-name strong, .clan-name small { display: block; }
.identity small, .clan-name small { color: var(--muted); font-size: .75rem; font-weight: 500; }
.clan-name { text-decoration: none; }
.empty-cell { padding: 4rem 1rem; color: var(--muted); text-align: center; }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 1.2rem; }
.pagination a, .pagination span { color: var(--muted); }
.pagination :last-child { justify-self: end; }

.back { display: inline-block; margin: 2rem 0; color: var(--muted); }
.profile { border-top: 1px solid var(--line); }
.profile-identity { display: flex; align-items: center; gap: 1.4rem; padding: 2rem 0; }
.profile-identity img, .profile-fallback { width: clamp(5rem, 11vw, 8rem); height: clamp(5rem, 11vw, 8rem); border-radius: 12px; object-fit: cover; background: var(--surface-2); }
.profile-fallback { display: grid; place-items: center; color: var(--accent); font-size: 2.4rem; font-weight: 950; }
.profile h2 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: 1; letter-spacing: -.045em; }
.muted { color: var(--muted); }
.profile-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.profile-metrics div { padding: 1.2rem 1rem 1.2rem 0; }
.profile-metrics dd { margin: .25rem 0 0; font-size: clamp(1rem, 2vw, 1.35rem); font-weight: 850; }
.profile-details { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; padding-top: 2rem; }
.profile-details h3 { font-size: 1.1rem; }
.profile-details dl { margin: 0; }
.profile-details dl div { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.profile-details dd { margin: 0; text-align: right; }

.login-shell { min-height: 100svh; display: grid; place-items: center; padding: 1rem; }
.login { width: min(420px, 100%); }
.login .brand-mark { width: 3.2rem; height: 3.2rem; margin-bottom: 2rem; font-size: 1.4rem; }
.login h1 { margin-bottom: 1rem; font-size: clamp(3rem, 12vw, 5.4rem); }
.login label { display: block; margin: 2rem 0 .45rem; color: var(--muted); font-size: .8rem; font-weight: 700; }
.login button { width: 100%; margin-top: .7rem; }
.notice { padding: .8rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.notice.error { color: var(--danger); }
.empty { padding: 5rem 0; }

@keyframes row-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes underline-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 880px) {
    .catalog-head { align-items: start; flex-direction: column; }
    .catalog-status { width: 100%; justify-content: space-between; }
    .profile-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .topbar { grid-template-columns: 1fr auto; }
    .topbar nav { grid-column: 1 / -1; grid-row: 2; justify-content: center; min-height: 45px; }
    .topbar form { grid-column: 2; grid-row: 1; }
    .brand span:last-child { display: none; }
    .filter-row { grid-template-columns: 1fr; }
    .catalog-status { gap: .7rem; }
    .catalog-status div { min-width: 0; }
    .catalog-status dd { font-size: .92rem; }
    .table-wrap { overflow: visible; border-bottom: 0; }
    table, tbody, tr, td { display: block; width: 100%; }
    thead { display: none; }
    tbody tr { padding: .55rem 0; border-bottom: 1px solid var(--line); }
    td { display: grid; grid-template-columns: minmax(7.5rem, 42%) 1fr; align-items: baseline; padding: .38rem 0; border: 0; white-space: normal; text-align: right; }
    td::before { content: attr(data-label); color: var(--muted); font-size: .72rem; text-align: left; text-transform: uppercase; }
    td:first-child { display: block; padding: .8rem 0; text-align: left; }
    td:first-child::before { display: none; }
    .identity { min-width: 0; }
    .profile-details { grid-template-columns: 1fr; gap: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
