@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Newsreader:opsz,wght@6..72,400..800&family=Noto+Serif+TC:wght@400;500;600;700;900&display=swap");
.admin-body {
    min-height: 100%;
    overflow: auto;
}

.admin-body .scene-field {
    position: fixed;
}

.admin-topbar {
    position: sticky;
    top: 14px;
    z-index: 60;
    width: min(var(--max), calc(100% - 28px));
    min-height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 14px auto 0;
}

.admin-shell {
    width: min(var(--max), calc(100% - 28px));
    margin: 0 auto;
    padding: clamp(34px, 6vw, 72px) 0 88px;
}

.login-shell {
    min-height: calc(100svh - 150px);
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(340px, 0.55fr);
    gap: clamp(24px, 5vw, 72px);
    align-items: center;
    padding: clamp(22px, 4vw, 54px) 0 clamp(48px, 7vw, 92px);
}

.login-copy {
    max-width: 720px;
}

.login-copy h1 {
    max-width: 14ch;
    margin: 0;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: clamp(52px, 6.6vw, 92px);
    line-height: 0.98;
    letter-spacing: 0;
    text-wrap: balance;
}

.login-copy h1 span {
    display: block;
}

.login-copy .lead {
    max-width: 620px;
}

.login-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
}

.login-highlights span {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 0 13px;
    color: rgba(255, 250, 241, 0.84);
    background: rgba(255, 255, 255, 0.08);
    font-size: 13px;
    font-weight: 830;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
    align-items: stretch;
}

.admin-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 32px;
    background:
        radial-gradient(circle at 12% 10%, rgba(255, 209, 102, 0.16), transparent 14rem),
        linear-gradient(134deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.045) 58%, rgba(116, 215, 255, 0.12)),
        rgba(14, 18, 34, 0.7);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        0 30px 96px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(16px) saturate(142%);
    -webkit-backdrop-filter: blur(16px) saturate(142%);
}

.auth-card {
    padding: 24px;
}

.login-card {
    align-self: center;
    padding: clamp(22px, 3vw, 32px);
}

body.is-admin .login-shell {
    min-height: auto;
    align-items: start;
    padding: 28px 0;
}

body.is-admin .login-copy h1 {
    font-size: clamp(38px, 4vw, 58px);
}

.admin-panel {
    padding: clamp(22px, 3vw, 34px);
}

.admin-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.admin-card-head span {
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 860;
    text-transform: uppercase;
}

.admin-card-head strong {
    color: var(--soft);
    font-size: 13px;
}

.config-warning {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid rgba(255, 209, 102, 0.3);
    border-radius: 20px;
    background: rgba(255, 209, 102, 0.08);
}

.config-warning strong {
    color: var(--accent-2);
}

.config-warning p {
    margin: 0;
    color: var(--soft);
    font-size: 14px;
    line-height: 1.65;
}

.config-warning code {
    color: #fff;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.92em;
}

.auth-actions,
.email-form,
.content-form {
    display: grid;
    gap: 14px;
}

.login-google {
    width: 100%;
}

.login-divider {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 28px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 780;
}

.login-divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
}

.login-divider span {
    position: relative;
    padding: 0 10px;
    background: rgba(15, 18, 31, 0.88);
}

.content-form {
    padding: 24px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.content-form:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.content-form h2 {
    font-size: clamp(30px, 3vw, 44px);
}

.content-form p {
    max-width: 58rem;
    margin: 4px 0 4px;
    color: var(--soft);
    font-size: 15px;
    line-height: 1.72;
}

label {
    display: grid;
    gap: 8px;
    color: var(--soft);
    font-size: 13px;
    font-weight: 780;
}

input,
textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 13px 14px;
    color: var(--ink);
    background: rgba(0, 0, 0, 0.24);
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: rgba(116, 215, 255, 0.58);
    background: rgba(0, 0, 0, 0.34);
    box-shadow:
        0 0 0 4px rgba(116, 215, 255, 0.12),
        0 0 36px rgba(116, 215, 255, 0.1);
}

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

.wide {
    grid-column: 1 / -1;
}

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

.toggle-line {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
}

.toggle-line input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-3);
}

.text-button {
    width: fit-content;
    border: 0;
    padding: 0;
    color: var(--accent-3);
    background: transparent;
    font-size: 13px;
    font-weight: 800;
}

.admin-work-list {
    display: grid;
    gap: 10px;
}

.admin-work-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.07);
}

.admin-work-item strong {
    display: block;
    color: var(--ink);
}

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

.admin-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 90;
    max-width: min(420px, calc(100% - 36px));
    min-height: 48px;
    display: grid;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    padding: 12px 16px;
    color: var(--ink);
    background: rgba(16, 20, 34, 0.82);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(18px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.admin-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

body:not(.firebase-ready) .auth-actions,
body:not(.is-admin) .admin-grid,
body:not(.is-admin) .admin-panel {
    display: none;
}

body.login-only .admin-grid,
.admin-grid[hidden] {
    display: none !important;
}

@media (max-width: 920px) {
    .login-shell,
    .admin-grid,
    .form-grid,
    .form-row {
        grid-template-columns: 1fr;
    }

    .auth-card {
        position: relative;
        top: auto;
    }
}

@media (max-width: 760px) {
    .admin-topbar {
        top: 10px;
        min-height: 56px;
    }

    .admin-shell {
        padding-top: 34px;
    }

    .login-copy h1 {
        font-size: 42px;
    }

    .login-shell {
        min-height: auto;
        padding-top: 132px;
    }
}

/* New separated console: login.html and dashboard.html */
.console-login-body,
.dashboard-body {
    min-height: 100%;
    position: relative;
    isolation: isolate;
    color: var(--ink);
    background: #070912;
    overflow-x: clip;
}

.console-login-body::before,
.console-login-body::after {
    display: none;
}

.console-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 20%, rgba(255, 122, 89, 0.22), transparent 26rem),
        radial-gradient(circle at 76% 24%, rgba(116, 215, 255, 0.22), transparent 30rem),
        radial-gradient(circle at 48% 84%, rgba(141, 123, 255, 0.16), transparent 34rem),
        linear-gradient(135deg, #070912, #111a2b 58%, #080a13);
}

.console-bg span {
    position: absolute;
    border-radius: 999px;
    opacity: 0.35;
    filter: blur(16px);
}

.console-bg span:nth-child(1) {
    left: 8%;
    top: 18%;
    width: 34vw;
    aspect-ratio: 1;
    background: rgba(255, 209, 102, 0.18);
}

.console-bg span:nth-child(2) {
    right: 10%;
    top: 20%;
    width: 30vw;
    aspect-ratio: 1;
    background: rgba(116, 215, 255, 0.18);
}

.console-bg span:nth-child(3) {
    left: 44%;
    bottom: -12%;
    width: 42vw;
    aspect-ratio: 1;
    background: rgba(141, 123, 255, 0.16);
}

.login-stage {
    width: min(1040px, calc(100% - 40px));
    min-height: 100svh;
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: clamp(28px, 5vw, 58px);
    margin: 0 auto;
    padding: 28px 0 56px;
}

.console-brand {
    width: max-content;
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    padding: 8px 16px 8px 8px;
    color: #fffaf1;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
        rgba(14, 20, 34, 0.94);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 18px 50px rgba(0, 0, 0, 0.28);
    opacity: 1;
}

.console-brand img {
    flex: 0 0 42px;
    width: 42px !important;
    height: 42px !important;
    max-width: 42px;
    max-height: 42px;
    border-radius: 14px;
    object-fit: cover;
    filter: brightness(1.16) saturate(1.12);
    opacity: 1;
}

.console-brand span {
    display: grid;
    gap: 2px;
}

.console-brand strong {
    color: #fffaf1;
    font-size: 18px;
    line-height: 1;
}

.console-brand small {
    color: rgba(255, 250, 241, 0.68);
    font-size: 12px;
    line-height: 1;
}

.login-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(380px, 420px);
    gap: clamp(30px, 5vw, 64px);
    align-items: center;
}

.login-message h1,
.dashboard-topbar h1,
.admin-module h2 {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-serif);
    letter-spacing: 0;
}

.login-message h1 {
    max-width: 9ch;
    font-size: clamp(58px, 6vw, 84px);
    line-height: 0.96;
}

.login-message h1 span {
    display: block;
}

.login-message p {
    max-width: 420px;
    color: rgba(255, 250, 241, 0.78);
    font-size: 18px;
    line-height: 1.6;
}

.security-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.security-row span,
.security-grid span {
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 999px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: rgba(255, 250, 241, 0.82);
    background: rgba(255, 255, 255, 0.07);
    font-size: 12px;
    font-weight: 830;
}

.login-panel,
.admin-module,
.stat-card {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.045) 56%, rgba(116, 215, 255, 0.08)),
        rgba(12, 18, 32, 0.9);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 28px 88px rgba(0, 0, 0, 0.28);
}

.login-panel {
    display: grid;
    gap: 12px;
    border-radius: 24px;
    padding: 28px;
    transform: translateZ(0);
}

.panel-title,
.module-head,
.dashboard-topbar,
.user-cluster {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-title span,
.module-head > span {
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.panel-title strong,
.module-head > span {
    color: rgba(255, 250, 241, 0.68);
}

.console-button {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 0 18px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.08);
    font: inherit;
    font-weight: 860;
    cursor: pointer;
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.console-button.primary {
    color: #071018;
    border-color: rgba(255, 234, 180, 0.8);
    background: linear-gradient(105deg, #fff3db, #ffd166 50%, #74d7ff 120%);
    box-shadow: 0 0 26px rgba(255, 209, 102, 0.18), 0 0 34px rgba(116, 215, 255, 0.12);
}

.console-button.compact {
    min-height: 46px;
    padding: 0 18px;
    font-size: 14px;
}

.login-panel label {
    display: grid;
    gap: 8px;
}

.login-panel label span {
    color: rgba(255, 250, 241, 0.74);
    font-size: 13px;
    font-weight: 820;
}

.login-panel input {
    min-height: 46px;
    border-color: rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.08);
}

.login-panel input:focus {
    border-color: rgba(116, 215, 255, 0.42);
    box-shadow: 0 0 0 3px rgba(116, 215, 255, 0.12);
}

.agreement-line {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    margin: 2px 0;
    color: rgba(255, 250, 241, 0.78);
    font-size: 13px;
    line-height: 1.55;
}

.agreement-line input {
    width: 18px;
    min-height: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--accent-3);
}

.agreement-line a {
    color: var(--accent-3);
    font-weight: 850;
}

.terms-stage {
    width: min(1180px, calc(100% - 40px));
    min-height: 100svh;
    position: relative;
    z-index: 1;
    display: grid;
    gap: 34px;
    margin: 0 auto;
    padding: 28px 0 72px;
}

.terms-shell {
    display: grid;
    gap: 16px;
}

.terms-panel {
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: clamp(20px, 3vw, 32px);
    color: rgba(255, 250, 241, 0.82);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.045) 56%, rgba(116, 215, 255, 0.08)),
        rgba(12, 18, 32, 0.9);
    box-shadow: 0 24px 78px rgba(0, 0, 0, 0.24);
}

.terms-hero {
    display: grid;
    gap: 10px;
}

.terms-hero h1,
.terms-panel h2 {
    margin: 0;
    color: #fffaf1;
    font-family: var(--font-serif);
    letter-spacing: 0;
}

.terms-hero h1 {
    font-size: clamp(42px, 5vw, 72px);
    line-height: 0.98;
}

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

.terms-panel h2 {
    font-size: clamp(28px, 3vw, 42px);
}

.terms-panel h3 {
    margin: 22px 0 8px;
    color: #fffaf1;
    font-size: 16px;
}

.terms-panel p {
    margin: 0 0 12px;
    line-height: 1.72;
}

.console-button:hover {
    transform: translateY(-1px);
    border-color: rgba(116, 215, 255, 0.34);
    box-shadow: 0 0 26px rgba(116, 215, 255, 0.18), 0 14px 42px rgba(0, 0, 0, 0.26);
}

.login-error {
    min-height: 22px;
    margin: 0;
    color: #ffb2a3;
    font-size: 13px;
    line-height: 1.55;
}

.login-error:not(.is-visible) {
    visibility: hidden;
}

.dashboard-loading {
    min-height: 100svh;
    display: grid;
    place-items: center;
    color: rgba(255, 250, 241, 0.78);
    font-weight: 760;
}

.dashboard-shell {
    width: min(1480px, calc(100% - 32px));
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 22px;
    margin: 0 auto;
    padding: 18px 0 70px;
}

.dashboard-sidebar {
    position: sticky;
    top: 18px;
    height: calc(100svh - 36px);
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 20px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 30px;
    padding: 14px;
    background: rgba(9, 13, 24, 0.86);
}

.dashboard-sidebar .console-brand {
    width: 100%;
    border-radius: 22px;
}

.dashboard-sidebar nav {
    display: grid;
    align-content: start;
    gap: 7px;
}

.dashboard-sidebar nav a,
.sidebar-link {
    min-height: 42px;
    display: flex;
    align-items: center;
    border-radius: 16px;
    padding: 0 13px;
    color: rgba(255, 250, 241, 0.74);
    background: transparent;
    font-weight: 800;
}

.dashboard-sidebar nav a:hover,
.sidebar-link:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.08);
}

.dashboard-main {
    display: grid;
    gap: 18px;
}

.dashboard-topbar {
    min-height: 84px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 30px;
    padding: 18px 22px;
    background: rgba(10, 15, 28, 0.86);
}

.dashboard-topbar h1 {
    font-size: clamp(34px, 4vw, 56px);
}

.user-cluster span {
    max-width: 260px;
    overflow: hidden;
    color: rgba(255, 250, 241, 0.72);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.stat-card {
    display: grid;
    gap: 8px;
    border-radius: 24px;
    padding: 20px;
}

.stat-card span,
.stat-card small {
    color: rgba(255, 250, 241, 0.66);
    font-weight: 780;
}

.stat-card strong {
    color: var(--ink);
    font-size: 30px;
    line-height: 1;
}

.admin-module {
    display: grid;
    gap: 18px;
    border-radius: 30px;
    padding: clamp(18px, 2.3vw, 28px);
}

.admin-module h2 {
    font-size: clamp(30px, 3vw, 44px);
}

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

.dashboard-form .wide,
.dashboard-form .checkline,
.dashboard-form button {
    grid-column: 1 / -1;
}

.checkline {
    display: flex;
    align-items: center;
    gap: 9px;
}

.checkline input {
    width: 18px;
    height: 18px;
}

.dashboard-list {
    display: grid;
    gap: 10px;
}

.dashboard-list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 13px;
    background: rgba(255, 255, 255, 0.06);
}

.dashboard-list-item strong {
    color: var(--ink);
}

.dashboard-list-item span {
    display: block;
    margin-top: 3px;
    color: rgba(255, 250, 241, 0.62);
    font-size: 13px;
}

.hermes-module iframe {
    width: 100%;
    height: min(76svh, 820px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    background: #101114;
}

.security-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.security-grid b {
    color: var(--accent-3);
    font-weight: 900;
}

@media (max-width: 1080px) {
    .login-hero,
    .dashboard-shell,
    .dashboard-grid,
    .dashboard-form,
    .terms-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        position: relative;
        top: auto;
        height: auto;
    }

    .dashboard-sidebar nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .login-stage,
    .dashboard-shell {
        width: min(100% - 24px, 1480px);
    }

    .login-stage {
        padding-top: 14px;
    }

    .login-hero {
        gap: 24px;
    }

    .login-message h1 {
        font-size: clamp(38px, 11vw, 56px);
    }

    .login-message p {
        font-size: 16px;
    }

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

    .dashboard-topbar,
    .module-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .user-cluster {
        width: 100%;
    }

    .user-cluster span {
        max-width: 100%;
    }

    .dashboard-list-item {
        grid-template-columns: 1fr;
    }

    .hermes-module iframe {
        height: 70svh;
    }
}

/* Avoid Chrome scroll flicker on glass cards by removing live backdrop blur. */
.admin-card,
.admin-toast,
.login-highlights span,
.admin-work-item {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform-style: flat;
    contain: paint;
}

.admin-card {
    background:
        radial-gradient(circle at 12% 10%, rgba(255, 209, 102, 0.14), transparent 14rem),
        linear-gradient(134deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05) 58%, rgba(116, 215, 255, 0.1)),
        rgba(14, 18, 34, 0.9);
}

.admin-toast {
    background: rgba(16, 20, 34, 0.94);
}
