:root {
    color-scheme: light;
    --canvas: #f4f4f2;
    --paper: #fff;
    --ink: #171717;
    --muted: #626260;
    --rule: #e3e3df;
    --line: #ccc;
    --coal: #191919;
    --orange: #f37021;
    --orange-hover: #ff843a;
    --orange-ink: #98400f;
    --orange-wash: #fff0e6;
    --sans: "Segoe UI Variable", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
    --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
    font-family: var(--sans);
    font-size: 15px;
}

* { box-sizing: border-box; }
body {
    display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
    margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.55;
}
form, p, dl { margin: 0; }
h1, h2 { margin: 0; }
h1 { font-size: clamp(1.48rem, 3.3vw, 2.15rem); line-height: 1.25; font-weight: 750; overflow-wrap: anywhere; }
h2 { font-size: 1.13rem; line-height: 1.35; font-weight: 720; margin-bottom: 1.2rem; }
h2 small { margin-left: .45rem; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
a { color: inherit; text-underline-offset: .2em; }
button, input, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--orange-ink); outline-offset: 3px; }

.wrap { width: min(1160px, calc(100% - 80px)); margin-inline: auto; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
}
.site-footer {
    padding: 0 1rem 1.15rem; text-align: center;
    color: var(--muted); font-size: .79rem; letter-spacing: .04em;
}
.skip {
    position: fixed; z-index: 2; top: .75rem; left: .75rem; transform: translateY(-160%);
    padding: .55rem .85rem; border-radius: 5px; background: var(--paper);
}
.skip:focus { transform: none; }
.bar { background: var(--coal); color: var(--paper); border-bottom: 1px solid #303030; }
.bar :focus-visible { outline-color: var(--orange); }
.bar-inner { display: flex; min-height: 72px; align-items: center; gap: clamp(1.25rem, 4vw, 3.8rem); }
.brand { display: inline-flex; align-items: center; gap: .67rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.brand-mark {
    display: inline-grid; flex: none; width: 30px; aspect-ratio: 1;
    grid-template: repeat(2, 1fr) / repeat(2, 1fr); gap: 2px; padding: 5px;
    border-radius: 7px; background: var(--orange); color: var(--coal);
}
.brand-mark i { border: 1.5px solid currentColor; border-radius: 1px; }
.brand-mark i:last-child { width: 62%; height: 62%; align-self: end; justify-self: end; background: currentColor; }
.bar nav { display: flex; gap: clamp(1rem, 3.2vw, 2.4rem); align-self: stretch; align-items: stretch; }
.bar nav a {
    display: flex; position: relative; align-items: center; white-space: nowrap;
    color: #c2c2c2; font-size: .9rem; font-weight: 550; text-decoration: none;
    transition: color 160ms ease;
}
.bar nav a:hover { color: var(--paper); }
.bar nav [aria-current] { color: var(--orange-hover); font-weight: 700; }
.bar nav [aria-current]::after {
    position: absolute; inset: auto 0 -1px; height: 2px; border-radius: 2px 2px 0 0;
    background: var(--orange); content: "";
}
.account { margin-left: auto; display: flex; align-items: center; min-width: 0; gap: .9rem; font-size: .85rem; }
.account-name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d4d4d4; }
.account form { border-left: 1px solid #454545; padding-left: .9rem; }
.account button.link { color: #eee; font-size: .86rem; }

.content { flex: 1; padding-block: clamp(1.65rem, 5vw, 3.5rem) 3.5rem; }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 0 0 1.65rem; }
.heading > div { min-width: 0; }
.heading p { margin-top: .53rem; }
.back { display: inline-block; margin-bottom: .85rem; color: var(--muted); font-size: .87rem; text-decoration: none; }
.back:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .89rem; }

.metrics {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 0 1.4rem; border: 1px solid var(--rule); border-radius: 13px;
    background: var(--paper); overflow: hidden;
}
.metric { min-width: 0; padding: 1.03rem 1.55rem 1.25rem; }
.metric + .metric { border-left: 1px solid var(--rule); }
.metric:first-child { color: var(--paper); background: var(--coal); }
.metric dt { color: var(--muted); font-size: .83rem; font-weight: 550; }
.metric:first-child dt { color: #cfcfcf; }
.metric dd {
    margin: .38rem 0 0; font-size: clamp(1.65rem, 4vw, 2.55rem); line-height: 1;
    letter-spacing: -.045em; font-weight: 700; font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.metric:first-child dd { color: var(--orange-hover); }
.panel { border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); }
.block { margin-bottom: 1.2rem; min-width: 0; padding: 1.42rem 1.5rem; }
.narrow { max-width: 530px; }
.table-block { padding: 0; }
.table-block > h2 { margin: 0; padding: 1.22rem 1.5rem; }
.table-heading {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .62rem 1rem;
    padding: .93rem 1.5rem;
}
.table-heading h2 { margin: 0; }
.scope-nav { display: flex; flex-wrap: wrap; gap: .3rem; }
.scope-nav a {
    padding: .32rem .62rem; border: 1px solid transparent; border-radius: 5px; color: var(--muted);
    font-size: .8rem; font-weight: 620; text-decoration: none;
}
.scope-nav a:hover { color: var(--ink); background: var(--canvas); }
.scope-nav [aria-current] { color: var(--orange-ink); border-color: #f4d4bf; background: var(--orange-wash); }
.empty { border-top: 1px solid var(--rule); padding: 1.85rem 1.5rem; }

button, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    border: 1px solid transparent; border-radius: 6px; background: var(--orange); color: var(--ink);
    min-height: 42px; padding: .38rem .95rem; font-size: .88rem; font-weight: 720;
    text-decoration: none; white-space: nowrap; cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
button:hover, .button:hover { background: var(--orange-hover); }
button:active, .button:active { transform: translateY(1px); }
.add::before { content: "+"; font-family: var(--sans); font-size: 1.2rem; font-weight: 500; line-height: 1; }
.secondary { background: var(--paper); border-color: var(--line); }
.secondary:hover { background: var(--canvas); border-color: #aaa; }
button.link {
    background: transparent; border: 0; color: var(--ink); min-height: 0;
    padding: 0; font-weight: 620; white-space: nowrap;
}
button.link:hover, summary:hover { text-decoration: underline; }
label { display: grid; gap: .42rem; color: var(--ink); font-size: .87rem; font-weight: 620; }
input, textarea {
    width: 100%; min-width: 0; padding: .58rem .7rem; color: var(--ink); background: var(--paper);
    border: 1px solid var(--line); border-radius: 6px; font-size: .91rem; font-weight: 400;
    transition: border-color 160ms ease;
}
input:hover, textarea:hover { border-color: #929292; }
input:focus, textarea:focus { border-color: var(--orange-ink); }
textarea { min-height: 101px; resize: vertical; }
textarea::placeholder { color: #737373; }
.fields { display: grid; gap: .85rem; }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; gap: .85rem; }
.inline-form label { width: min(240px, 100%); }
.inline-form input[type="date"] { min-height: 40px; }
.expiry-help { margin-top: .65rem; }
.alert { margin-bottom: 1rem; padding: .65rem .85rem; border-radius: 5px; font-size: .91rem; }
.success { color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-left: 3px solid var(--orange); }
.error { color: #762f0b; background: var(--orange-wash); border: 1px solid #f2c8af; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .89rem; }
th, td { padding: .82rem .75rem; text-align: left; white-space: nowrap; vertical-align: top; }
tr > :first-child { padding-left: 1.5rem; }
tr > :last-child { padding-right: 1.5rem; }
thead th { color: var(--muted); background: #f7f7f6; border-block: 1px solid var(--rule); font-size: .8rem; font-weight: 650; }
tbody tr + tr { border-top: 1px solid var(--rule); }
tbody tr:hover { background: #fafaf9; }
.table-block tbody tr:last-child > :first-child { border-bottom-left-radius: 11px; }
.table-block tbody tr:last-child > :last-child { border-bottom-right-radius: 11px; }
tbody th { min-width: 7rem; white-space: normal; overflow-wrap: anywhere; font-weight: 690; }
tbody th a { text-decoration-color: #a8a8a8; }
tbody th a:hover { color: var(--orange-ink); text-decoration-color: currentColor; }
.url-cell { min-width: 12rem; max-width: 26rem; white-space: normal; overflow-wrap: anywhere; font-family: var(--mono); font-size: .8rem; }
.status {
    display: inline-flex; align-items: center; gap: .4rem; padding: .09rem .42rem;
    border-radius: 4px; color: var(--muted); background: #f1f1ef; font-size: .79rem; font-weight: 650;
}
.status::before { width: 6px; height: 6px; border-radius: 50%; background: #888; content: ""; }
.status.on { color: #76320c; background: var(--orange-wash); }
.status.on::before { background: #bd4e12; }
.pagination { display: flex; justify-content: end; align-items: center; gap: 1rem; padding: 1rem 1.5rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .86rem; }
.pagination a { color: var(--ink); }

.project-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr); gap: 1.15rem; }
.qr-row { display: flex; align-items: center; gap: 1.05rem; }
.qr-frame {
    flex: none; width: 154px; aspect-ratio: 1; display: grid; place-items: center; padding: 8px;
    border: 1px solid var(--rule); border-radius: 9px; background: var(--canvas);
}
.qr-frame img { display: block; width: 100%; height: auto; border-radius: 3px; background: var(--paper); }
.qr-address { margin-top: .9rem; }
.qr-address textarea {
    min-height: 0; resize: none; overflow-wrap: anywhere;
    background: var(--canvas); font-family: var(--mono); font-size: .8rem;
}
.member-actions { display: flex; gap: .85rem; }
summary { cursor: pointer; font-weight: 620; }
.reset { min-width: 180px; margin-top: .65rem; }

.solo { flex: 1; display: grid; place-items: center; padding: 1.25rem; }
.login {
    width: min(100%, 760px); display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, 1fr);
    border: 1px solid var(--rule); border-radius: 16px; background: var(--paper); overflow: hidden;
    box-shadow: 0 14px 48px #1717170c;
}
.login-brand { position: relative; overflow: hidden; padding: 2rem; color: var(--paper); background: var(--coal); }
.login-brand > .brand { position: relative; z-index: 1; }
.login-pattern {
    position: absolute; width: min(93%, 300px); right: .58rem; bottom: -.4rem;
    pointer-events: none;
}
.particle-orbit { stroke: #46403c; stroke-width: .6; }
.particle-finder { stroke: #f58a49; }
.particle-finder rect:last-child { fill: var(--orange); }
.qr-particle {
    fill: #d5c6bc; transform-box: fill-box; transform-origin: center;
    animation: particle-drift 5.8s ease-in-out infinite;
}
.qr-particle.amber { fill: var(--orange-hover); }
.drift-0 { --dx: 15px; --dy: -26px; }
.drift-1 { --dx: 24px; --dy: 4px; animation-delay: -.27s; }
.drift-2 { --dx: -30px; --dy: -9px; animation-delay: -.54s; }
.drift-3 { --dx: -10px; --dy: 20px; animation-delay: -.81s; }
.drift-4 { --dx: -23px; --dy: -22px; animation-delay: -1.08s; }
.drift-5 { --dx: 30px; --dy: 25px; animation-delay: -1.35s; }
.drift-6 { --dx: 4px; --dy: 29px; animation-delay: -1.62s; }
@keyframes particle-drift {
    0%, 25%, 100% { transform: translate(0, 0) scale(1); opacity: .94; }
    57%, 68% { transform: translate(var(--dx), var(--dy)) scale(.55); opacity: .37; }
}
.login-content { padding: clamp(1.45rem, 5vw, 3rem); }
.login h1 { margin: 0 0 1.45rem; font-size: clamp(1.38rem, 3.1vw, 1.85rem); }
.login .fields { gap: 1rem; }
.login .fields button { margin-top: .33rem; }
.notice { width: min(100%, 420px); padding: clamp(1.45rem, 5vw, 2.25rem); text-align: center; }
.notice > .brand-mark { margin-bottom: .92rem; }
.notice h1 { font-size: clamp(1.45rem, 5vw, 2rem); }
.notice p, .notice form { margin-top: .9rem; }
.notice p { color: var(--muted); }
.scan-flow { display: grid; width: min(100%, 480px); justify-items: center; }
.scan-flight {
    display: block; width: 100%; height: auto; overflow: hidden;
    border: 1px solid #e3e3e0; border-radius: 22px;
}
.flight-plane { opacity: 0; }
.scan-flight.is-flying .flight-plane { opacity: 1; }
.flight-wake { stroke-dasharray: 1; stroke-dashoffset: 1; }
.scan-flight.is-flying .flight-wake { animation: wake-crossing 900ms linear both; }
.scan-flow button { margin-top: .9rem; }
.scan-flow button[hidden] { display: none; }
@keyframes wake-crossing { to { stroke-dashoffset: 0; } }

@media (max-width: 900px) {
    .wrap { width: calc(100% - 48px); }
    .metric { padding-inline: 1.05rem; }
    .qr-frame { width: 120px; }
}

@media (max-width: 700px) {
    .wrap { width: calc(100% - 30px); }
    .bar-inner { min-height: 0; flex-wrap: wrap; gap: 0 .9rem; padding-top: .72rem; }
    .bar nav { order: 3; width: 100%; gap: 1.35rem; }
    .bar nav a { min-height: 42px; }
    .account-name { max-width: 6rem; }
    .content { padding-top: 1.65rem; }
    .heading { margin-bottom: 1.15rem; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric { padding: .85rem .95rem 1rem; }
    .metric:nth-child(3) { border-left: 0; }
    .metric:nth-child(n + 3) { border-top: 1px solid var(--rule); }
    .block, .table-block > h2, .table-heading, .empty, .pagination { padding-inline: 1rem; }
    .table-block { padding: 0; }
    tr > :first-child { padding-left: 1rem; }
    tr > :last-child { padding-right: 1rem; }
    .project-tools { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .qr-row { gap: .78rem; }
    .login { grid-template-columns: minmax(0, 1fr); max-width: 430px; }
    .login-brand { padding: 1rem 1.45rem; }
    .login-pattern { width: 145px; right: -.7rem; bottom: -3.55rem; opacity: .65; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
    .qr-particle, .scan-flight.is-flying .flight-wake { animation: none; }
    .flight-plane { opacity: 1; transform: translate(240px, 122px) rotate(-20deg); }
}
