:root {
    --bg-a: #075fd1;
    --bg-b: #14a8ff;
    --bg-c: #eaf7ff;
    --ink: #0b1d34;
    --muted: #52708f;
    --line: rgba(255, 255, 255, .46);
    --glass: rgba(255, 255, 255, .58);
    --glass-strong: rgba(255, 255, 255, .74);
    --primary: #096ee8;
    --primary-dark: #0752ad;
    --aqua: #15c6ff;
    --danger: #c83255;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    background:
        linear-gradient(115deg, rgba(255,255,255,.58), rgba(255,255,255,0) 32%),
        linear-gradient(145deg, var(--bg-a) 0%, #0c87e8 42%, var(--bg-b) 68%, var(--bg-c) 100%);
    background-attachment: fixed;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(100deg, rgba(255,255,255,.18), transparent 34%, rgba(255,255,255,.16) 66%, transparent),
        repeating-linear-gradient(135deg, rgba(255,255,255,.08) 0 1px, transparent 1px 18px);
    mix-blend-mode: screen;
    opacity: .56;
    animation: surfaceFlow 14s ease-in-out infinite alternate;
}

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

.glass {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.82), rgba(255,255,255,.44)),
        rgba(255, 255, 255, .52);
    box-shadow:
        0 18px 60px rgba(7, 69, 148, .22),
        inset 0 1px 0 rgba(255,255,255,.82),
        inset 0 -1px 0 rgba(255,255,255,.22);
    backdrop-filter: blur(24px) saturate(145%);
}

.glass::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, transparent 0%, rgba(255,255,255,.28) 38%, transparent 58%),
        linear-gradient(180deg, rgba(255,255,255,.24), transparent 48%);
    transform: translateX(-38%);
    animation: liquidSheen 8s ease-in-out infinite;
}

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

.login-window {
    width: min(440px, 100%);
    padding: 34px;
}

.brand-mark {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.54);
    border-radius: 8px;
    color: white;
    font-size: 29px;
    font-weight: 800;
    background:
        linear-gradient(145deg, rgba(255,255,255,.28), rgba(255,255,255,0)),
        linear-gradient(145deg, #075ee0, #15c6ff);
    box-shadow: 0 14px 34px rgba(7, 93, 205, .32);
}

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

.login-window h1 {
    margin: 22px 0 8px;
    font-size: 31px;
}

.login-window p,
.panel-title span {
    color: var(--muted);
}

.form-stack {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

input,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(9, 110, 232, .22);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: rgba(255, 255, 255, .76);
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.74);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus,
select:focus {
    border-color: rgba(9, 110, 232, .82);
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 0 0 4px rgba(21, 198, 255, .16), inset 0 1px 0 rgba(255,255,255,.9);
}

button,
.app-launch {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    color: white;
    font-weight: 800;
    cursor: pointer;
    background:
        linear-gradient(145deg, rgba(255,255,255,.22), transparent 42%),
        linear-gradient(135deg, var(--primary), var(--aqua));
    box-shadow: 0 12px 28px rgba(8, 101, 219, .28);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

button:hover,
.app-launch:hover {
    transform: translateY(-2px);
    filter: saturate(112%);
    box-shadow: 0 18px 36px rgba(8, 101, 219, .34);
}

.alert {
    margin-top: 18px;
    border: 1px solid rgba(200, 50, 85, .16);
    border-radius: 8px;
    padding: 12px;
    color: var(--danger);
    background: rgba(255, 235, 241, .84);
}

.ghost-link {
    display: inline-flex;
    justify-content: center;
    min-height: 38px;
    align-items: center;
    border-radius: 8px;
    color: var(--primary-dark);
    font-weight: 700;
    transition: background .18s ease, transform .18s ease;
}

.ghost-link:hover {
    background: rgba(255,255,255,.46);
    transform: translateY(-1px);
}

.scope-list {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 10px 14px;
    margin: 22px 0 0;
}

.scope-list dt {
    color: var(--muted);
}

.scope-list dd {
    margin: 0;
    font-weight: 700;
}

.admin-body {
    padding: 22px;
}

.topbar {
    display: flex;
    position: sticky;
    top: 16px;
    z-index: 2;
    align-items: center;
    justify-content: space-between;
    max-width: 1280px;
    margin: 0 auto 22px;
    padding: 16px 20px;
}

.topbar strong {
    display: block;
    font-size: 21px;
}

.topbar span {
    color: var(--muted);
    font-size: 13px;
}

.top-actions {
    display: flex;
    gap: 14px;
    align-items: center;
}

.dashboard {
    display: grid;
    max-width: 1280px;
    gap: 20px;
    margin: 0 auto;
}

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

.lazy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
    padding: 18px;
}

.stat-card b {
    display: block;
    font-size: 30px;
    line-height: 1;
}

.stat-card span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
}

.secret-grid {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px 12px;
    align-items: center;
    margin-top: 12px;
}

.secret-grid span {
    color: var(--muted);
    font-size: 14px;
}

.secret-grid code {
    overflow-x: auto;
}

.panel,
.notice {
    padding: 20px;
}

.notice {
    color: #06458e;
}

.panel-title {
    display: flex;
    gap: 16px;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
}

.panel-title h2 {
    margin-bottom: 0;
    font-size: 22px;
}

.inline-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
    gap: 10px;
    margin-bottom: 16px;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 8px;
}

.card-list {
    display: grid;
    gap: 12px;
}

.manage-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid rgba(255,255,255,.54);
    border-radius: 8px;
    padding: 14px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.74), rgba(255,255,255,.4)),
        rgba(255,255,255,.48);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 10px 28px rgba(8, 86, 180, .12);
    transition: transform .18s ease, box-shadow .18s ease;
}

.manage-card:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.88), 0 18px 36px rgba(8, 86, 180, .18);
}

.manage-card h3,
.manage-card p {
    margin: 0;
}

.manage-card h3 {
    font-size: 16px;
}

.manage-card p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}

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

.manage-actions form {
    margin: 0;
}

.manage-actions button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.status-pill {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    border: 1px solid rgba(9, 110, 232, .14);
    border-radius: 8px;
    padding: 0 10px;
    color: #06458e;
    font-size: 13px;
    font-weight: 700;
    background: rgba(224, 243, 255, .76);
}

table {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
    background: rgba(255, 255, 255, .48);
}

th,
td {
    border-bottom: 1px solid rgba(9, 110, 232, .12);
    padding: 12px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

tr {
    transition: background .18s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, .45);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 180px;
}

.actions form {
    margin: 0;
}

.actions button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
}

th {
    color: #24557f;
    background: rgba(221, 243, 255, .74);
}

code {
    border: 1px solid rgba(9, 110, 232, .1);
    border-radius: 6px;
    padding: 2px 6px;
    color: #06458e;
    background: rgba(224, 243, 255, .78);
    white-space: nowrap;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}

.app-card {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 12px;
    align-items: center;
    min-height: 92px;
    border: 1px solid rgba(255,255,255,.54);
    border-radius: 8px;
    padding: 16px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.8), rgba(255,255,255,.42)),
        rgba(255,255,255,.5);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 12px 32px rgba(8, 86, 180, .15);
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.app-card:hover {
    transform: translateY(-4px);
    background:
        linear-gradient(145deg, rgba(255,255,255,.9), rgba(255,255,255,.5)),
        rgba(255,255,255,.58);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.92), 0 22px 44px rgba(8, 86, 180, .22);
}

.app-icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 8px;
    color: white;
    font-weight: 900;
    background:
        linear-gradient(145deg, rgba(255,255,255,.3), transparent 44%),
        linear-gradient(145deg, #075ee0, #15c6ff);
    box-shadow: 0 12px 26px rgba(7, 93, 205, .28);
}

.app-card h3,
.app-card p {
    margin: 0;
}

.app-card h3 {
    font-size: 16px;
}

.app-launch {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
}

.float-in {
    animation: floatIn .58s ease both;
}

.delay-1 {
    animation-delay: .06s;
}

.delay-2 {
    animation-delay: .12s;
}

.delay-3 {
    animation-delay: .18s;
}

.delay-4 {
    animation-delay: .24s;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes liquidSheen {
    0%, 52% {
        transform: translateX(-46%);
        opacity: .42;
    }
    78%, 100% {
        transform: translateX(42%);
        opacity: .7;
    }
}

@keyframes surfaceFlow {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(18px, -12px, 0);
    }
}

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

@media (max-width: 900px) {
    .admin-body {
        padding: 14px;
    }

    .topbar,
    .panel,
    .notice {
        padding: 16px;
    }

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

    .stats-grid,
    .lazy-grid {
        grid-template-columns: 1fr;
    }

    .manage-card {
        grid-template-columns: 1fr;
    }

    .manage-actions {
        justify-content: flex-start;
    }

    .panel-title {
        display: block;
    }

    .app-card {
        grid-template-columns: 48px 1fr;
    }

    .app-launch {
        grid-column: 1 / -1;
        width: 100%;
    }
}

@media (max-width: 560px) {
    .auth-body {
        padding: 14px;
    }

    .login-window {
        padding: 24px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .top-actions {
        width: 100%;
        justify-content: space-between;
    }
}
