:root {
    color-scheme: light;
    --uni-primary: #2979ff;
    --uni-primary-strong: #1764e8;
    --uni-success: #18b566;
    --uni-warning: #f3a73f;
    --uni-danger: #e43d33;
    --uni-text: #172033;
    --uni-subtle: #4b5565;
    --uni-muted: #737b8c;
    --uni-border: #e3e8f1;
    --uni-border-strong: #d4dce9;
    --uni-bg: #f5f7fb;
    --uni-card: #ffffff;
    --uni-soft-blue: #eef5ff;
    --uni-soft-green: #eaf8f0;
    --uni-soft-amber: #fff5e5;
    --shadow-card: 0 18px 48px rgba(23, 32, 51, .08);
    --shadow-soft: 0 8px 24px rgba(23, 32, 51, .06);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--uni-text);
    background: var(--uni-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    letter-spacing: 0;
}

a {
    color: var(--uni-primary);
    text-decoration: none;
}

small {
    color: var(--uni-muted);
}

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

h1 {
    margin-bottom: 0;
    font-size: 40px;
    line-height: 1.16;
}

h2 {
    margin-bottom: 14px;
    font-size: 22px;
    line-height: 1.3;
}

.uni-page {
    min-height: 100vh;
}

.auth-shell,
.query-shell,
.admin-shell {
    width: calc(100% - 32px);
    max-width: 1180px;
    margin: 0 auto;
}

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

.auth-shell.compact {
    max-width: 560px;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
}

.query-shell {
    padding: 26px 0 52px;
}

.query-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 48px;
    margin-bottom: 42px;
}

.query-brand {
    color: var(--uni-text);
    font-weight: 800;
}

.query-brand .brand-logo {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
}

.query-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: end;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--uni-primary);
    font-size: 14px;
    font-weight: 800;
}

.hero-copy {
    max-width: 620px;
    margin: 14px 0 0;
    color: var(--uni-subtle);
    font-size: 16px;
    line-height: 1.7;
}

.query-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.query-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(340px, .88fr);
    gap: 18px;
    align-items: stretch;
}

.uni-card {
    width: 100%;
    padding: 24px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--uni-border);
    border-radius: 8px;
    box-shadow: var(--shadow-card);
}

.license-form {
    min-height: 426px;
}

.card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.card-title-row h2 {
    margin-bottom: 4px;
}

.card-title-row p {
    margin-bottom: 0;
    color: var(--uni-muted);
    line-height: 1.55;
}

.uni-forms {
    display: grid;
    gap: 16px;
}

.query-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

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

.uni-forms-item {
    display: grid;
    gap: 8px;
}

.uni-forms-item > span {
    color: #303a4d;
    font-size: 14px;
    font-weight: 800;
}

.uni-input,
.uni-select,
.uni-textarea {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    color: var(--uni-text);
    background: #fff;
    border: 1px solid var(--uni-border-strong);
    border-radius: 6px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.uni-textarea {
    min-height: 96px;
    padding-top: 12px;
    resize: vertical;
}

.uni-input:hover,
.uni-select:hover,
.uni-textarea:hover {
    border-color: #b8c6db;
}

.uni-input:focus,
.uni-select:focus,
.uni-textarea:focus {
    border-color: var(--uni-primary);
    box-shadow: 0 0 0 3px rgba(41, 121, 255, .14);
}

.uni-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    color: #fff;
    background: var(--uni-primary);
    border: 0;
    border-radius: 6px;
    box-shadow: 0 8px 16px rgba(41, 121, 255, .18);
    font-weight: 800;
    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease;
    white-space: nowrap;
}

.uni-btn:hover {
    background: var(--uni-primary-strong);
    box-shadow: 0 10px 20px rgba(41, 121, 255, .22);
    transform: translateY(-1px);
}

.uni-btn.primary {
    background: var(--uni-primary);
}

.uni-btn.success {
    background: var(--uni-success);
    box-shadow: 0 8px 16px rgba(24, 181, 102, .18);
}

.uni-btn.light {
    color: var(--uni-text);
    background: #eef2f7;
    box-shadow: none;
}

.uni-btn.light:hover {
    background: #e4ebf5;
    box-shadow: none;
}

.uni-btn.danger {
    background: var(--uni-danger);
    box-shadow: 0 8px 16px rgba(228, 61, 51, .16);
}

.uni-btn.compact-btn {
    min-height: 38px;
    padding: 0 14px;
}

.uni-btn:disabled {
    opacity: .68;
    cursor: not-allowed;
    transform: none;
}

.uni-tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.uni-tag.primary {
    color: #1959c9;
    background: var(--uni-soft-blue);
}

.uni-tag.success {
    color: #0b7d42;
    background: var(--uni-soft-green);
}

.uni-tag.danger {
    color: #b5221a;
    background: #fdecea;
}

.uni-tag.warning {
    color: #8a5700;
    background: var(--uni-soft-amber);
}

.uni-notice {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
}

.uni-notice.success {
    color: #0b7d42;
    background: var(--uni-soft-green);
}

.uni-notice.danger {
    color: #b5221a;
    background: #fdecea;
}

.result-panel {
    display: grid;
    min-height: 426px;
}

.result-panel.success {
    border-color: rgba(24, 181, 102, .26);
}

.result-panel.danger {
    border-color: rgba(228, 61, 51, .26);
}

.empty-state {
    display: grid;
    min-height: 320px;
    place-items: center;
    align-content: center;
    text-align: center;
    color: var(--uni-muted);
}

.empty-state h2 {
    margin: 16px 0 8px;
    color: var(--uni-text);
}

.empty-state p {
    margin-bottom: 0;
    line-height: 1.6;
}

.empty-icon-wrap {
    display: grid;
    width: 88px;
    height: 88px;
    place-items: center;
    background: linear-gradient(135deg, var(--uni-soft-blue), var(--uni-soft-green));
    border-radius: 8px;
}

.empty-icon {
    width: 58px;
    height: 58px;
}

.result-skeleton {
    display: grid;
    width: min(260px, 100%);
    gap: 10px;
    margin-top: 22px;
}

.result-skeleton span {
    height: 10px;
    background: #edf1f7;
    border-radius: 999px;
}

.result-skeleton span:nth-child(2) {
    width: 74%;
    justify-self: center;
}

.result-skeleton span:nth-child(3) {
    width: 56%;
    justify-self: center;
}

.loader {
    width: 38px;
    height: 38px;
    border: 4px solid #e8edf5;
    border-top-color: var(--uni-primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.result-head {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 20px;
}

.result-head h2 {
    margin: 10px 0 0;
}

.result-mark {
    display: grid;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    place-items: center;
    color: #fff;
    border-radius: 8px;
    font-size: 26px;
    font-weight: 900;
}

.result-mark.success {
    background: var(--uni-success);
}

.result-mark.danger {
    background: var(--uni-danger);
}

.result-list {
    display: grid;
    border-top: 1px solid var(--uni-border);
}

.result-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--uni-border);
}

.result-row span {
    color: var(--uni-muted);
}

.result-row strong {
    overflow-wrap: anywhere;
}

.result-code {
    margin: 16px 0 0;
    color: var(--uni-muted);
    font-size: 13px;
}

.admin-body {
    background: #f7f8fb;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--uni-border);
    box-shadow: 0 8px 24px rgba(23, 32, 51, .04);
    backdrop-filter: blur(12px);
}

.admin-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
    gap: 18px;
}

.admin-brand {
    color: var(--uni-text);
    font-size: 16px;
}

.admin-brand .brand-logo {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
}

.admin-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.admin-links a {
    min-height: 36px;
    padding: 8px 11px;
    color: #394456;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
}

.admin-links a.active,
.admin-links a:hover {
    color: var(--uni-primary);
    background: var(--uni-soft-blue);
}

.admin-main {
    padding: 26px 0 52px;
}

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

.page-head h1 {
    margin-bottom: 8px;
    font-size: 30px;
}

.page-head p {
    margin-bottom: 0;
    color: var(--uni-muted);
    line-height: 1.65;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.account-stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card {
    box-shadow: var(--shadow-soft);
}

.account-stats-grid .stat-card {
    min-height: 96px;
    padding: 18px 20px;
    border: 1px solid rgba(216, 226, 241, .86);
    border-radius: 8px;
    background: rgba(255, 255, 255, .86);
}

.stat-card span {
    color: var(--uni-muted);
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 32px;
    line-height: 1.1;
}

.table-card {
    overflow-x: auto;
}

.account-report-table {
    padding-top: 18px;
}

.account-report-table .uni-table {
    min-width: 980px;
}

.account-empty-state {
    min-height: 220px;
    padding: 38px 16px;
}

.release-table-card {
    overflow-x: hidden;
}

.uni-table {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.split-grid .uni-table {
    min-width: 100%;
}

.release-table {
    min-width: 0;
    table-layout: fixed;
}

.release-table th:nth-child(1) {
    width: 13%;
}

.release-table th:nth-child(2) {
    width: 8%;
}

.release-table th:nth-child(3) {
    width: 17%;
}

.release-table th:nth-child(4) {
    width: 30%;
}

.release-table th:nth-child(5) {
    width: 9%;
}

.release-table th:nth-child(6) {
    width: 23%;
}

.release-table td,
.release-table small {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.release-table .hash-cell small,
.release-table .file-cell small {
    display: block;
    line-height: 1.5;
}

.release-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.release-actions form {
    margin: 0;
}

.uni-table th,
.uni-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--uni-border);
    text-align: left;
    vertical-align: top;
}

.uni-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #4b5563;
    background: #f8fafd;
    font-weight: 900;
}

.uni-table tr:hover td {
    background: #fbfdff;
}

.report-actions {
    min-width: 120px;
}

.license-logins {
    min-width: 138px;
}

.license-logins .uni-btn {
    margin: 0 0 6px;
    text-decoration: none;
}

.license-logins small {
    display: block;
    margin-bottom: 8px;
    white-space: nowrap;
}

.report-actions small {
    display: block;
    margin-top: 6px;
    white-space: nowrap;
}

.report-data {
    min-width: 96px;
    white-space: nowrap;
}

.data-modal[hidden] {
    display: none;
}

.modal-open {
    overflow: hidden;
}

.data-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
}

.data-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, .46);
    cursor: pointer;
}

.data-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(860px, 100%);
    max-height: min(760px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--uni-border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}

.data-modal-head {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--uni-border);
    background: #f8fafd;
}

.data-modal-head h2 {
    margin: 0 0 6px;
    font-size: 18px;
}

.data-modal-head p {
    margin: 0;
    color: var(--uni-muted);
    font-size: 13px;
}

.data-modal-close {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid var(--uni-border);
    border-radius: 8px;
    color: var(--uni-text);
    background: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.data-modal-pre {
    min-height: 220px;
    max-height: calc(100vh - 180px);
    margin: 0;
    padding: 18px 20px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: #dbeafe;
    background: #0f172a;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
    line-height: 1.65;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.actions .uni-input,
.actions .uni-select {
    width: auto;
    min-width: 132px;
}

.checkbox-row {
    display: flex;
    gap: 8px;
    align-items: center;
    color: #303a4d;
    font-size: 14px;
    font-weight: 800;
}

.split-grid {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

@media (max-width: 920px) {
    .query-grid,
    .split-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .query-hero,
    .page-head,
    .admin-nav {
        align-items: stretch;
        flex-direction: column;
    }

    .query-badges {
        justify-content: flex-start;
    }

    .admin-links {
        justify-content: flex-start;
    }

    h1 {
        font-size: 32px;
    }
}

@media (max-width: 1180px) and (min-width: 921px) {
    .account-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .auth-shell,
    .query-shell,
    .admin-shell {
        width: calc(100% - 24px);
    }

    .query-shell {
        padding-top: 18px;
    }

    .query-topbar {
        margin-bottom: 28px;
    }

    .query-form-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }

    .uni-card {
        padding: 18px;
    }

    .query-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .result-row {
        grid-template-columns: 80px minmax(0, 1fr);
    }

    .admin-links {
        overflow-x: auto;
        flex-wrap: nowrap;
        width: 100%;
        padding-bottom: 4px;
    }
}

.plain-query-page {
    background: #f7f8fb;
}

.plain-query-shell {
    display: grid;
    width: min(640px, calc(100% - 28px));
    min-height: 100vh;
    margin: 0 auto;
    place-items: center;
    padding: 32px 0;
}

.plain-query-card {
    display: grid;
    gap: 22px;
    box-shadow: 0 12px 32px rgba(23, 32, 51, .06);
}

.plain-query-head {
    display: flex;
    gap: 14px;
    align-items: center;
}

.plain-query-head h1 {
    font-size: 30px;
}

.plain-result {
    padding: 14px;
    color: var(--uni-muted);
    background: #f8fafc;
    border: 1px solid var(--uni-border);
    border-radius: 6px;
}

.plain-result.success {
    color: var(--uni-text);
    background: #f6fffa;
    border-color: rgba(24, 181, 102, .32);
}

.plain-result.danger {
    color: var(--uni-text);
    background: #fff8f7;
    border-color: rgba(228, 61, 51, .28);
}

.plain-result.loading {
    color: var(--uni-muted);
}

.simple-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.simple-result-head h2 {
    margin: 0;
    font-size: 18px;
}

.plain-result .result-list {
    border-top: 1px solid var(--uni-border);
}

.plain-result .result-row:last-child {
    border-bottom: 0;
}

@media (max-width: 620px) {
    .plain-query-shell {
        place-items: start center;
        padding-top: 24px;
    }

    .plain-query-head h1 {
        font-size: 26px;
    }
}
