:root {
    --dashboard-bg: #08040f;
    --dashboard-bg-soft: #0d0718;
    --dashboard-panel: rgba(17, 10, 29, .86);
    --dashboard-panel-solid: #130b21;
    --dashboard-panel-raised: #1a102a;
    --dashboard-line: rgba(255, 255, 255, .09);
    --dashboard-line-strong: rgba(255, 255, 255, .16);
    --dashboard-text: #f5f2ed;
    --dashboard-muted: #aaa3b5;
    --dashboard-purple: #8b5cf6;
    --dashboard-indigo: #6366f1;
    --dashboard-amber: #f4c86a;
    --dashboard-green: #4adea1;
    --dashboard-red: #fb7185;
    --dashboard-shadow: 0 28px 80px rgba(0, 0, 0, .36);
}

.dashboard-shell,
.auth-shell {
    --ink: var(--dashboard-text);
    --ink-soft: var(--dashboard-muted);
    --paper: var(--dashboard-bg);
    --surface: var(--dashboard-panel-solid);
    --line: var(--dashboard-line);
    --line-strong: var(--dashboard-line-strong);
    --blue: var(--dashboard-purple);
    --blue-dark: #7048df;
    --cyan: #67e8f9;
    --violet: #a78bfa;
    --coral: #fb8d78;
    --green: var(--dashboard-green);
    --amber: var(--dashboard-amber);
    --danger: var(--dashboard-red);
    --shadow: var(--dashboard-shadow);
    --font-body: "Geist Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    --font-display: "General Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--dashboard-text);
    background:
        radial-gradient(circle at 76% -10%, rgba(99, 102, 241, .18), transparent 30rem),
        radial-gradient(circle at 16% 75%, rgba(139, 92, 246, .1), transparent 34rem),
        var(--dashboard-bg);
}

.dashboard-shell::before {
    content: "";
    position: fixed;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    opacity: .3;
    background-image:
        linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: linear-gradient(to right, transparent, #000 28%, #000 78%, transparent);
}

.dashboard-shell :focus-visible,
.auth-shell :focus-visible {
    outline: 2px solid rgba(167, 139, 250, .9);
    outline-offset: 3px;
}

.dashboard-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 278px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    z-index: 50;
    top: 0;
    display: flex;
    height: 100vh;
    padding: 22px 17px 18px;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--dashboard-line);
    background: rgba(8, 4, 15, .82);
    box-shadow: 18px 0 60px rgba(0, 0, 0, .14);
    backdrop-filter: blur(24px) saturate(130%);
}

.sidebar::after {
    content: "";
    position: absolute;
    right: -1px;
    top: 12%;
    width: 1px;
    height: 30%;
    background: linear-gradient(transparent, rgba(167, 139, 250, .75), transparent);
    box-shadow: 0 0 24px rgba(139, 92, 246, .5);
}

.sidebar-aurora {
    position: absolute;
    width: 250px;
    height: 250px;
    left: -120px;
    top: -125px;
    border-radius: 50%;
    pointer-events: none;
    background: rgba(99, 102, 241, .22);
    filter: blur(65px);
}

.sidebar-brand-row {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 52px;
    padding: 0 9px;
    align-items: center;
    justify-content: space-between;
}

.dashboard-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.dashboard-brand img {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(139, 92, 246, .25);
}

.dashboard-brand > span {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.dashboard-brand strong {
    overflow: hidden;
    color: var(--dashboard-text);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-brand small {
    color: #777083;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .13em;
}

.sidebar-close {
    display: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--dashboard-line);
    border-radius: 50%;
    background: rgba(255, 255, 255, .04);
    color: var(--dashboard-muted);
    cursor: pointer;
    font-size: 20px;
}

.role-chip {
    position: relative;
    display: flex;
    min-height: 58px;
    margin: 23px 4px 19px;
    padding: 11px 13px;
    align-items: center;
    gap: 11px;
    overflow: hidden;
    border: 1px solid var(--dashboard-line);
    border-radius: 14px;
    background: linear-gradient(115deg, rgba(99, 102, 241, .11), rgba(255, 255, 255, .025));
}

.role-chip::after {
    content: "";
    position: absolute;
    width: 70px;
    height: 70px;
    right: -38px;
    top: -42px;
    border-radius: 50%;
    background: rgba(244, 200, 106, .12);
    filter: blur(18px);
}

.role-chip > i {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--dashboard-green);
    box-shadow: 0 0 0 5px rgba(74, 222, 161, .09), 0 0 18px rgba(74, 222, 161, .5);
}

.role-chip > span {
    display: flex;
    flex-direction: column;
}

.role-chip b {
    color: #ded9e6;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .02em;
}

.role-chip small {
    color: #706979;
    font-size: 7px;
    font-weight: 700;
    letter-spacing: .12em;
}

.side-nav {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .1) transparent;
}

.side-nav-group > p {
    margin: 0 0 7px;
    padding: 0 11px;
    color: #6e6778;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .13em;
}

.side-nav a {
    position: relative;
    display: grid;
    min-height: 53px;
    padding: 7px 10px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #8f8899;
    transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease;
}

.side-nav a:hover {
    transform: translateX(2px);
    border-color: rgba(255, 255, 255, .065);
    background: rgba(255, 255, 255, .035);
    color: #ddd8e4;
}

.side-nav a.active {
    border-color: rgba(167, 139, 250, .22);
    background: linear-gradient(100deg, rgba(99, 102, 241, .2), rgba(139, 92, 246, .08));
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 10px 28px rgba(0, 0, 0, .13);
}

.side-nav a.active::before {
    content: "";
    position: absolute;
    width: 3px;
    height: 24px;
    left: 0;
    top: 50%;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(var(--dashboard-purple), var(--dashboard-amber));
    transform: translateY(-50%);
    box-shadow: 0 0 14px rgba(139, 92, 246, .75);
}

.side-nav-icon {
    display: grid;
    width: 32px !important;
    height: 32px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 9px;
    background: rgba(255, 255, 255, .025);
    color: #837b90 !important;
}

.side-nav a.active .side-nav-icon {
    border-color: rgba(167, 139, 250, .24);
    background: rgba(167, 139, 250, .12);
    color: #c4b5fd !important;
}

.side-nav-icon svg,
.text-button svg,
.topbar-home svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.side-nav-icon svg path[d*="M4 4h6"] {
    fill: currentColor;
    stroke: none;
}

.side-nav a > .side-nav-copy {
    display: flex;
    width: auto;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    color: inherit;
    line-height: 1.2;
    text-align: left;
    writing-mode: horizontal-tb;
}

.side-nav a > .side-nav-copy b {
    display: block;
    width: 100%;
    overflow: hidden;
    font-size: 12px;
    font-weight: 580;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-nav a > .side-nav-copy small {
    display: block;
    width: 100%;
    margin-top: 3px;
    overflow: hidden;
    color: #665f70;
    font-size: 8px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-nav a.active .side-nav-copy small {
    color: #938aa1;
}

.side-nav a.active > .side-nav-copy {
    color: #fff;
}

.side-nav-arrow {
    opacity: 0;
    color: var(--dashboard-amber);
    font-size: 12px;
    font-style: normal;
    transform: translateX(-5px);
    transition: opacity .2s ease, transform .2s ease;
}

.side-nav a:hover .side-nav-arrow,
.side-nav a.active .side-nav-arrow {
    opacity: 1;
    transform: translateX(0);
}

.sidebar-footer {
    margin-top: 17px;
    padding: 16px 5px 0;
    border-top: 1px solid var(--dashboard-line);
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar,
.topbar-avatar {
    display: grid;
    place-items: center;
    border: 1px solid rgba(167, 139, 250, .22);
    background: linear-gradient(145deg, rgba(99, 102, 241, .28), rgba(139, 92, 246, .14));
    color: #ede9fe;
    font-family: var(--font-display);
    font-weight: 650;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 13px;
}

.user-mini > div {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.user-mini strong {
    overflow: hidden;
    color: #ddd8e4;
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-mini small {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #746d7d;
    font-size: 8px;
}

.user-mini small i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--dashboard-green);
}

.text-button {
    display: flex;
    width: 100%;
    min-height: 36px;
    margin-top: 10px;
    padding: 0 10px;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #706979;
    cursor: pointer;
    font-size: 10px;
    transition: color .18s ease, background .18s ease;
}

.text-button:hover {
    background: rgba(251, 113, 133, .07);
    color: #fda4af;
}

.sidebar-backdrop {
    display: none;
}

.dashboard-main {
    min-width: 0;
}

.dashboard-topbar {
    position: sticky;
    z-index: 40;
    top: 0;
    display: flex;
    min-height: 88px;
    padding: 16px clamp(24px, 3.5vw, 52px);
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    border-bottom: 1px solid var(--dashboard-line);
    background: rgba(8, 4, 15, .68);
    backdrop-filter: blur(24px) saturate(140%);
}

.dashboard-topbar::after {
    content: "";
    position: absolute;
    height: 1px;
    left: 9%;
    right: 9%;
    bottom: -1px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, .42), rgba(244, 200, 106, .25), transparent);
}

.topbar-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 14px;
}

.topbar-title .eyebrow {
    margin: 0 0 2px;
    color: #777083;
    font-size: 8px;
    letter-spacing: .14em;
}

.dashboard-topbar h1 {
    margin: 0;
    color: var(--dashboard-text);
    font-family: var(--font-display);
    font-size: clamp(20px, 2vw, 27px);
    font-weight: 520;
    letter-spacing: -.03em;
}

.menu-button {
    display: none;
    width: 40px;
    height: 40px;
    padding: 10px;
    border: 1px solid var(--dashboard-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .035);
    cursor: pointer;
}

.menu-button span {
    display: block;
    width: 100%;
    height: 1px;
    margin: 4px 0;
    background: #d8d2df;
}

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

.topbar-token {
    display: flex;
    min-height: 48px;
    padding: 7px 14px 7px 11px;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--dashboard-line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .025);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

.token-spark {
    position: relative;
    width: 27px;
    height: 27px;
    border-radius: 9px;
    background: linear-gradient(145deg, rgba(99, 102, 241, .25), rgba(244, 200, 106, .12));
}

.token-spark::before,
.token-spark::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    background: linear-gradient(#a78bfa, #f4c86a);
    transform: translate(-50%, -50%) rotate(45deg);
}

.token-spark::before {
    width: 2px;
    height: 13px;
}

.token-spark::after {
    width: 13px;
    height: 2px;
}

.topbar-token > span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.topbar-token small {
    color: #7c7585;
    font-size: 8px;
}

.topbar-token b {
    color: #eee9f2;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
}

.topbar-token b i {
    color: #7f7789;
    font-size: 8px;
    font-style: normal;
    font-weight: 500;
}

.topbar-home {
    display: inline-flex;
    min-height: 42px;
    padding: 0 13px;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--dashboard-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .025);
    color: #9e96a8;
    font-size: 10px;
    transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.topbar-home:hover {
    border-color: rgba(167, 139, 250, .28);
    background: rgba(139, 92, 246, .08);
    color: #ddd6fe;
}

.topbar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 12px;
}

.dashboard-content {
    width: min(1380px, 100%);
    margin: 0 auto;
    padding: 34px clamp(24px, 3.5vw, 52px) 72px;
}

.dashboard-route-novel-workbench .dashboard-content,
.dashboard-route-image-workbench .dashboard-content {
    width: min(1660px, 100%);
}

.dashboard-flashes {
    width: 100%;
}

.flash {
    margin: 0 0 14px;
    padding: 12px 15px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .16);
    backdrop-filter: blur(16px);
}

.flash-success { border-color: rgba(74, 222, 161, .25); background: rgba(74, 222, 161, .07); color: #91edc2; }
.flash-error { border-color: rgba(251, 113, 133, .28); background: rgba(251, 113, 133, .07); color: #fda4af; }
.flash-info { border-color: rgba(167, 139, 250, .25); background: rgba(139, 92, 246, .08); color: #c4b5fd; }

/* Dashboard overview and management surfaces */
.welcome-strip,
.admin-welcome {
    position: relative;
    min-height: 220px;
    padding: clamp(28px, 4vw, 48px);
    overflow: hidden;
    border: 1px solid var(--dashboard-line);
    border-radius: 24px;
    background:
        radial-gradient(circle at 85% 18%, rgba(139, 92, 246, .21), transparent 20rem),
        linear-gradient(125deg, rgba(25, 15, 42, .96), rgba(12, 7, 22, .9));
    box-shadow: var(--dashboard-shadow), inset 0 1px 0 rgba(255, 255, 255, .045);
}

.welcome-strip::before,
.admin-welcome::before {
    content: "";
    position: absolute;
    width: 54%;
    height: 1px;
    left: 7%;
    bottom: 0;
    background: linear-gradient(90deg, transparent, var(--dashboard-purple), var(--dashboard-amber), transparent);
    box-shadow: 0 0 22px rgba(139, 92, 246, .55);
}

.welcome-strip h2,
.admin-welcome h2 {
    max-width: 720px;
    margin: 6px 0 10px;
    color: #faf7ff;
    font-family: var(--font-display);
    font-size: clamp(29px, 4vw, 45px);
    font-weight: 500;
    letter-spacing: -.045em;
}

.welcome-strip p:last-child,
.admin-welcome p:last-child {
    max-width: 680px;
    color: #9e96aa;
    font-size: 13px;
}

.welcome-strip .eyebrow,
.admin-welcome .eyebrow,
.section-heading .eyebrow,
.panel-heading .eyebrow,
.invite-create .eyebrow,
.settings-panel .eyebrow,
.novel-studio .eyebrow,
.image-studio .eyebrow {
    color: #9f8df5;
}

.orbit-badge {
    width: 148px;
    height: 148px;
    flex: 0 0 148px;
    border-color: rgba(167, 139, 250, .22);
    background: radial-gradient(circle, rgba(99, 102, 241, .1), transparent 67%);
}

.orbit-badge::before { border-color: rgba(244, 200, 106, .2); }
.orbit-badge b { background: linear-gradient(135deg, #6366f1, #a855f7); box-shadow: 0 0 0 12px rgba(139, 92, 246, .1), 0 0 50px rgba(139, 92, 246, .3); }
.orbit-badge i:first-child { background: #67e8f9; }
.orbit-badge i:nth-child(2) { background: #f4c86a; }

.section-block { margin-top: 38px; }
.section-heading { margin-bottom: 16px; }
.section-heading h2,
.panel-heading h2,
.invite-create h2,
.settings-panel h2 {
    color: #eeeaf2;
    font-weight: 520;
}

.workbench-cards {
    gap: 16px;
}

.workbench-card {
    position: relative;
    min-height: 270px;
    padding: 24px;
    overflow: hidden;
    border: 1px solid var(--dashboard-line);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(24, 14, 39, .92), rgba(13, 8, 23, .88));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

.workbench-card::after {
    content: "";
    position: absolute;
    width: 190px;
    height: 190px;
    right: -95px;
    top: -110px;
    border-radius: 50%;
    background: rgba(99, 102, 241, .14);
    filter: blur(30px);
    transition: transform .3s ease, background .3s ease;
}

.workbench-card:nth-child(2)::after { background: rgba(244, 140, 120, .12); }
.workbench-card:hover { transform: translateY(-4px); border-color: rgba(167, 139, 250, .24); box-shadow: 0 22px 60px rgba(0, 0, 0, .27), inset 0 1px 0 rgba(255, 255, 255, .055); }
.workbench-card:hover::after { transform: scale(1.2); }
.workbench-icon { width: 45px; height: 45px; margin-bottom: 29px; border-color: rgba(167, 139, 250, .22); border-radius: 13px; background: rgba(139, 92, 246, .1); color: #c4b5fd; }
.workbench-card:nth-child(1) .workbench-icon,
.workbench-card:nth-child(2) .workbench-icon { font-size: 0; }
.workbench-card:nth-child(1) .workbench-icon::before { content: "文"; font-size: 15px; font-weight: 700; }
.workbench-card:nth-child(2) .workbench-icon::before { content: "图"; font-size: 15px; font-weight: 700; }
.workbench-card small { color: #777083; }
.workbench-card h3 { color: #f2eef5; font-size: 22px; font-weight: 540; }
.workbench-card p { color: #958d9f; }
.card-link { border-color: var(--dashboard-line); color: #c4b5fd; }

.live-status {
    padding: 7px 11px;
    border: 1px solid rgba(74, 222, 161, .18);
    border-radius: 999px;
    background: rgba(74, 222, 161, .06);
    color: #86e9b9;
}

.stat-grid {
    margin: 20px 0;
    gap: 12px;
}

.stat-card {
    position: relative;
    min-height: 132px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid var(--dashboard-line);
    border-radius: 17px;
    background: rgba(19, 11, 32, .78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

.stat-card::after {
    content: "";
    position: absolute;
    width: 38px;
    height: 2px;
    left: 20px;
    bottom: 17px;
    background: linear-gradient(90deg, var(--dashboard-purple), transparent);
}

.stat-card span { color: #8e8698; }
.stat-card strong { color: #f4eff8; font-family: var(--font-display); font-size: 32px; font-weight: 520; }

.data-panel,
.invite-create,
.settings-panel {
    overflow: hidden;
    border: 1px solid var(--dashboard-line);
    border-radius: 20px;
    background: rgba(17, 10, 29, .82);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .035);
}

.panel-heading {
    min-height: 92px;
    padding: 20px 24px;
    border-color: var(--dashboard-line);
    background: rgba(255, 255, 255, .015);
}

.table-wrap { scrollbar-color: rgba(167, 139, 250, .28) transparent; }
table { color: #bbb3c2; }
th, td { padding: 16px 20px; border-color: rgba(255, 255, 255, .055); }
th { background: rgba(255, 255, 255, .018); color: #746d7e; }
tbody tr:hover { background: rgba(139, 92, 246, .045); }
td strong { color: #e6e0eb; }
code { color: #a89fb3; }
.invite-code { color: #c4b5fd; }
.status-dot.success { color: #86e9b9; }
.status-dot.success::before { background: var(--dashboard-green); box-shadow: 0 0 10px rgba(74, 222, 161, .45); }
.status-dot.danger { color: #fda4af; }
.status-dot.danger::before { background: var(--dashboard-red); }
.status-dot.muted { color: #817989; }
.table-action { border-color: var(--dashboard-line-strong); border-radius: 8px; background: rgba(255, 255, 255, .025); color: #aaa1b3; }
.table-action:hover { border-color: rgba(167, 139, 250, .4); background: rgba(139, 92, 246, .08); color: #ddd6fe; }
.empty-cell { color: #746d7e; }

.search-form input,
.field input,
.field select,
.field textarea,
.mode-switch select,
.chapter-plan input,
.image-prompt-field textarea {
    border-color: var(--dashboard-line-strong);
    background: rgba(7, 4, 13, .56);
    color: #eee9f2;
    color-scheme: dark;
}

.search-form input::placeholder,
.field input::placeholder,
.field textarea::placeholder,
.image-prompt-field textarea::placeholder,
.manuscript-editor::placeholder {
    color: #625a6c;
}

.field > span,
.field-action-head > span,
.image-compose-heading span { color: #d9d2df; }
.field small,
.field-action-head small { color: #7d7587; }
.field input:focus,
.field select:focus,
.field textarea:focus,
.image-prompt-field textarea:focus {
    border-color: rgba(167, 139, 250, .65);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, .1), 0 12px 35px rgba(0, 0, 0, .18);
}

.button {
    min-height: 44px;
    border-color: rgba(167, 139, 250, .32);
    border-radius: 11px;
    background: linear-gradient(125deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 12px 30px rgba(99, 102, 241, .2), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.button:hover { background: linear-gradient(125deg, #7174f2, #9b6df8); box-shadow: 0 16px 38px rgba(99, 102, 241, .28); }
.button-secondary { border-color: var(--dashboard-line-strong); background: rgba(255, 255, 255, .035); color: #c4b5fd; box-shadow: none; }
.button-secondary:hover { border-color: rgba(167, 139, 250, .4); background: rgba(139, 92, 246, .09); }
.invite-create { padding: 28px; }
.invite-create p:not(.eyebrow), .settings-panel > div > p:not(.eyebrow) { color: #8f8799; }
.settings-panel { padding: 32px; }

/* Novel workbench */
.novel-toolbar {
    min-height: 82px;
    margin-bottom: 18px;
    padding: 15px 18px;
    border-color: var(--dashboard-line);
    border-radius: 17px;
    background: rgba(17, 10, 29, .82);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.model-pulse { background: var(--dashboard-green); box-shadow: 0 0 0 6px rgba(74, 222, 161, .08), 0 0 20px rgba(74, 222, 161, .35); }
.novel-model-state small, .mode-switch > span { color: #777083; }
.novel-model-state strong { color: #e8e2ec; }
.model-settings-button,
.workbench-help-button {
    border-color: var(--dashboard-line-strong);
    background: rgba(255, 255, 255, .035);
    color: #b9aef2;
}
.workbench-help-button:hover,
.model-settings-button:hover { border-color: rgba(167, 139, 250, .45); color: #ddd6fe; }

.story-track::before { background: rgba(255, 255, 255, .09); }
.story-track span { color: #716a7a; }
.story-track i { border-color: var(--dashboard-line-strong); background: var(--dashboard-bg); }
.story-track span.active { color: #c4b5fd; }
.story-track span.active i { border-color: #8b5cf6; background: linear-gradient(145deg, #6366f1, #8b5cf6); box-shadow: 0 0 0 6px rgba(139, 92, 246, .08), 0 0 24px rgba(139, 92, 246, .25); }
.story-track span.complete i { border-color: rgba(74, 222, 161, .3); background: rgba(74, 222, 161, .08); color: #86e9b9; }

.novel-compose {
    border-color: var(--dashboard-line);
    border-radius: 20px;
    background: var(--dashboard-panel);
    box-shadow: var(--dashboard-shadow), inset 0 1px 0 rgba(255, 255, 255, .035);
}

.novel-input-panel {
    border-color: var(--dashboard-line);
    background: rgba(14, 8, 24, .86);
}

.novel-output-panel {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px),
        rgba(10, 6, 18, .9);
    background-size: 30px 100%;
}

.novel-panel-heading h2 { color: #f0ebf4; font-weight: 520; }
.novel-panel-heading > span { color: #756e7e; }
.character-section,
.creative-console,
.story-contract-input,
.chapter-plan,
.premise-assistant,
.source-file-state,
.source-analysis-state,
.director-console,
.prose-audit {
    border-color: var(--dashboard-line);
    background: rgba(255, 255, 255, .025);
}

.character-section { border-radius: 13px; }
.character-section-head span { color: #ded8e4; }
.character-section-head small, .character-empty span { color: #7f7789; }
.add-character-button,
.inline-ai-button,
.txt-import-button {
    border-color: rgba(167, 139, 250, .25);
    border-radius: 8px;
    background: rgba(139, 92, 246, .08);
    color: #c4b5fd;
}
.add-character-button:hover,
.inline-ai-button:hover,
.txt-import-button:hover { border-color: rgba(167, 139, 250, .5); background: rgba(139, 92, 246, .14); }
.character-empty { border-color: rgba(255, 255, 255, .1); color: #706979; }
.character-empty b { color: #8e8698; }
.character-card { border-color: var(--dashboard-line); background: rgba(255, 255, 255, .025); }
.character-avatar { background: rgba(99, 102, 241, .13); color: #c4b5fd; }
.character-card b { color: #ded8e4; }

.story-contract-input { border-left-color: #67e8f9; background: rgba(103, 232, 249, .025); }
.creative-console summary b, .story-contract-input summary b { color: #dcd6e2; }
.creative-console summary small, .story-contract-input summary small { color: #777083; }
.creative-control b { color: #cfc8d5; }
.creative-control output { color: #c4b5fd; }
.creative-control small { color: #776f80; }
.creative-control input[type="range"] { accent-color: var(--dashboard-purple); }

.premise-assistant { border-left-color: var(--dashboard-purple); }
.premise-candidate { border-color: var(--dashboard-line); background: rgba(7, 4, 13, .5); }
.premise-candidate:hover { border-color: rgba(167, 139, 250, .3); }
.premise-candidate p { color: #b0a8b8; }
.premise-candidate button { background: rgba(139, 92, 246, .12); color: #c4b5fd; }
.source-file-mark { background: rgba(74, 222, 161, .08); color: #86e9b9; }
.source-analysis-state.ready { border-color: rgba(74, 222, 161, .2); background: rgba(74, 222, 161, .04); }

.chapter-plan { border-radius: 13px; }
.chapter-plan-copy span, .chapter-plan label > span { color: #d7d0dd; }
.chapter-plan-copy small, .chapter-plan label small { color: #746d7d; }
.humanize-toggle b { color: #ded8e4; }
.humanize-toggle small { color: #746d7d; }
.toggle-track { border-color: var(--dashboard-line-strong); background: rgba(255, 255, 255, .06); }
.humanize-toggle input:checked + .toggle-track { background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.stop-generate-button { border-color: rgba(251, 113, 133, .22); background: rgba(251, 113, 133, .06); color: #fda4af; }
.novel-form-status { color: #8f8799; }

.director-console { border-radius: 13px; }
.director-console header { border-color: var(--dashboard-line); }
.director-console b { color: #ded8e4; }
.director-console small, .director-console p { color: #837b8d; }
.director-contract > div, .chapter-brief > div { border-color: var(--dashboard-line); background: rgba(255, 255, 255, .018); }

.manuscript-empty span {
    border-color: rgba(167, 139, 250, .25);
    background: rgba(139, 92, 246, .08);
    color: #c4b5fd;
    box-shadow: 0 0 45px rgba(139, 92, 246, .12);
}
.manuscript-empty h3 { color: #e9e3ed; }
.manuscript-empty p { color: #7e7688; }
.manuscript-editor { color: #e7dfeb; font-family: "Noto Serif SC", "Songti SC", "STSong", serif; caret-color: #c4b5fd; }
.manuscript-editor.is-streaming { background-image: linear-gradient(90deg, transparent, rgba(139, 92, 246, .055), transparent); }
.output-actions button { border-color: var(--dashboard-line); background: rgba(255, 255, 255, .025); color: #9f97a9; }
.output-actions button:hover:not(:disabled) { border-color: rgba(167, 139, 250, .32); color: #ddd6fe; }
.stream-progress { border-color: rgba(74, 222, 161, .2); background: rgba(74, 222, 161, .06); color: #86e9b9; }
.manuscript-meta { border-color: var(--dashboard-line); color: #756e7e; }
.manuscript-meta b { color: #c4b5fd; }

/* Image workbench */
.image-studio {
    border-color: var(--dashboard-line);
    border-radius: 20px;
    background: var(--dashboard-panel);
    box-shadow: var(--dashboard-shadow), inset 0 1px 0 rgba(255, 255, 255, .035);
}

.image-studio-toolbar {
    border-color: var(--dashboard-line);
    background: linear-gradient(105deg, rgba(24, 14, 39, .9), rgba(13, 8, 23, .86));
}
.image-studio-toolbar h2 { color: #f1ecf5; font-weight: 520; }
.image-studio-toolbar > div:first-child > p:last-child { color: #827a8c; }
.image-model-state { border-color: var(--dashboard-line); border-radius: 13px; background: rgba(7, 4, 13, .48); }
.image-model-lens { border-color: #a78bfa; box-shadow: inset 0 0 0 5px rgba(139, 92, 246, .1), 0 0 18px rgba(139, 92, 246, .16); }
.image-model-lens::after { background: #f4c86a; }
.image-model-state small { color: #746d7d; }
.image-model-state strong { color: #ded8e4; }
.image-model-state button { border-color: var(--dashboard-line); color: #c4b5fd; }
.image-compose-panel { border-color: var(--dashboard-line); background: rgba(13, 8, 23, .84); }
.image-gallery-panel { background: rgba(9, 5, 16, .86); }
.image-prompt-notes button { border-color: var(--dashboard-line); border-radius: 8px; background: rgba(255, 255, 255, .025); color: #91899b; }
.image-prompt-notes button:hover { border-color: rgba(167, 139, 250, .35); background: rgba(139, 92, 246, .07); color: #c4b5fd; }
.image-output-settings { border-color: var(--dashboard-line); }
.image-ratio-preview { border-color: var(--dashboard-line); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.image-ratio-preview::before { border-color: #a78bfa; background: rgba(139, 92, 246, .08); box-shadow: 8px 8px 0 rgba(244, 200, 106, .08); }
.image-ratio-preview span { background: rgba(8, 4, 15, .78); color: #d8ccff; }
.image-generate-button { border-color: rgba(167, 139, 250, .3); background: linear-gradient(125deg, #6366f1, #8b5cf6); box-shadow: 0 12px 30px rgba(99, 102, 241, .22); }
.image-generate-button:hover { background: linear-gradient(125deg, #7375f4, #9a69f6); }
.image-storage-note > span { border-color: rgba(244, 200, 106, .2); color: #f4c86a; }
.image-storage-note p { color: #756e7e; }
.image-storage-note b { color: #cfc8d5; }
.image-gallery-panel > header h2 { color: #f0ebf4; font-weight: 520; }
.image-gallery-panel > header > span { color: #756e7e; }
.image-gallery-panel > header > span b { color: #f4c86a; }
.image-result-card { border-color: var(--dashboard-line); border-radius: 13px; background: rgba(255, 255, 255, .025); }
.image-result-card:hover { border-color: rgba(167, 139, 250, .24); box-shadow: 0 18px 44px rgba(0, 0, 0, .3); }
.image-result-frame { background: #0b0712; }
.image-expiry-badge { border-color: rgba(255, 255, 255, .12); border-radius: 7px; background: rgba(8, 4, 15, .76); }
.image-result-card footer strong { color: #ddd7e2; }
.image-result-card footer small { color: #756e7e; }
.image-card-actions a, .image-card-actions button { border-color: var(--dashboard-line); border-radius: 7px; background: rgba(255, 255, 255, .025); color: #c4b5fd; }
.image-card-actions button { color: #fda4af; }
.image-card-actions a:hover { border-color: rgba(167, 139, 250, .3); background: rgba(139, 92, 246, .08); }
.image-card-actions button:hover { border-color: rgba(251, 113, 133, .28); background: rgba(251, 113, 133, .06); }
.image-render-placeholder { border-color: var(--dashboard-line); border-radius: 13px; background: rgba(255, 255, 255, .025); color: #817989; }
.image-render-placeholder::before { background: rgba(167, 139, 250, .08); }
.image-render-placeholder i { border-color: #a78bfa; border-right-color: transparent; }
.empty-aperture { border-color: var(--dashboard-line); background: rgba(255, 255, 255, .025); }
.empty-aperture::before, .empty-aperture::after, .empty-aperture i { background: #a78bfa; }
.image-gallery-empty h3 { color: #e9e3ed; }
.image-gallery-empty p { color: #7e7688; }
.image-gallery-meta { border-color: var(--dashboard-line); color: #756e7e; }
.image-gallery-meta b { color: #f4c86a; }

/* Dialogs */
.model-modal-backdrop,
.onboarding-backdrop {
    background: rgba(4, 2, 8, .78);
    backdrop-filter: blur(18px) saturate(120%);
}

.model-modal,
.onboarding-dialog {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 22px;
    background:
        radial-gradient(circle at 90% -10%, rgba(139, 92, 246, .18), transparent 17rem),
        #130b21;
    color: var(--dashboard-text);
    box-shadow: 0 40px 120px rgba(0, 0, 0, .58), inset 0 1px 0 rgba(255, 255, 255, .055);
}

.image-model-modal { border-top: 1px solid rgba(255, 255, 255, .11); }

.model-modal::before,
.onboarding-dialog::before {
    content: "";
    position: absolute;
    height: 1px;
    left: 12%;
    right: 12%;
    top: 0;
    background: linear-gradient(90deg, transparent, #8b5cf6, #f4c86a, transparent);
    box-shadow: 0 0 20px rgba(139, 92, 246, .5);
}

.model-modal-head h2,
.onboarding-dialog h2 { color: #f4eff7; font-weight: 520; }
.model-modal-head p:last-child,
.onboarding-dialog header p:last-child { color: #8f8799; }
.modal-close { border-color: var(--dashboard-line); background: rgba(255, 255, 255, .035); color: #9c94a5; }
.modal-close:hover { border-color: rgba(167, 139, 250, .34); background: rgba(139, 92, 246, .08); color: #fff; }
.model-fetch-row [data-model-status],
[data-image-model-status] { color: #8f8799; }
.guide-edition { color: #f4c86a; }
.guide-route { border-color: var(--dashboard-line); }
.guide-route article + article { border-color: var(--dashboard-line); }
.guide-route i { color: #a78bfa; }
.guide-route b { color: #ded8e4; }
.guide-route p, .guide-footnote { color: #817989; }

/* Authentication now uses the same visual world as the product. */
.auth-layout { background: var(--dashboard-bg); }
.auth-scene {
    background:
        radial-gradient(circle at 76% 20%, rgba(139, 92, 246, .28), transparent 18rem),
        radial-gradient(circle at 15% 82%, rgba(99, 102, 241, .2), transparent 22rem),
        #090510;
}
.auth-scene::before { background: radial-gradient(circle, rgba(244, 200, 106, .12), transparent 65%); }
.auth-scene-copy .eyebrow { color: #a78bfa; }
.auth-scene-copy h1 { color: #f6f2f8; font-weight: 500; }
.auth-scene-copy > p:last-child { color: #9c94a6; }
.auth-orbit { border-color: rgba(167, 139, 250, .18); }
.auth-orbit::before, .auth-orbit::after { border-color: rgba(255, 255, 255, .08); }
.auth-orbit span:nth-child(1) { background: #a78bfa; }
.auth-orbit span:nth-child(2) { background: #f4c86a; }
.auth-orbit span:nth-child(3) { background: #67e8f9; }
.auth-panel { background: radial-gradient(circle at 100% 0, rgba(99, 102, 241, .09), transparent 25rem); }
.auth-card { padding: 32px; border: 1px solid var(--dashboard-line); border-radius: 24px; background: rgba(17, 10, 29, .62); box-shadow: 0 35px 100px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .035); backdrop-filter: blur(18px); }
.auth-heading h2 { color: #f3eef6; font-weight: 520; }
.auth-heading > p:last-child { color: #8d8597; }
.remember-option { color: #d4ceda; }
.remember-option input { accent-color: #8b5cf6; }
.remember-option small, .auth-switch { color: #7f7789; }
.auth-switch a { color: #c4b5fd; }
.captcha legend { color: #d9d2df; }
.captcha-image-wrap { border-color: var(--dashboard-line); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.captcha-help { color: #817989; }
.captcha-digits input { border-color: var(--dashboard-line-strong); border-radius: 11px; background: rgba(7, 4, 13, .58); color: #f0ebf4; }
.captcha-digits input:focus { border-color: #a78bfa; box-shadow: 0 9px 25px rgba(0, 0, 0, .22), 0 0 0 4px rgba(139, 92, 246, .1); }
.captcha-digits input.filled { border-color: rgba(74, 222, 161, .5); }
.form-errors { border-color: rgba(251, 113, 133, .25); border-left-color: var(--dashboard-red); border-radius: 12px; background: rgba(251, 113, 133, .07); color: #fda4af; }

@media (max-width: 1180px) {
    .dashboard-layout { grid-template-columns: 246px minmax(0, 1fr); }
    .sidebar { padding-inline: 13px; }
    .dashboard-content { padding-inline: 28px; }
    .topbar-token { display: none; }
}

@media (max-width: 900px) {
    .dashboard-layout { display: block; }
    .sidebar {
        position: fixed;
        z-index: 100;
        width: min(294px, calc(100vw - 44px));
        left: 0;
        top: 0;
        transform: translateX(-104%);
        transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close, .menu-button { display: block; }
    .sidebar-backdrop {
        position: fixed;
        z-index: 90;
        display: block;
        inset: 0;
        border: 0;
        background: rgba(3, 1, 7, .68);
        opacity: 0;
        pointer-events: none;
        backdrop-filter: blur(8px);
        transition: opacity .25s ease;
    }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    .dashboard-topbar { min-height: 78px; padding-inline: 22px; }
    .dashboard-content { padding: 26px 22px 56px; }
    .topbar-avatar { display: none; }
}

@media (max-width: 760px) {
    .dashboard-topbar { gap: 14px; }
    .topbar-title .eyebrow { display: none; }
    .dashboard-topbar h1 { font-size: 20px; }
    .topbar-home { width: 40px; padding: 0; justify-content: center; }
    .topbar-home span { display: none; }
    .topbar-home::after { content: none; }
    .dashboard-content { padding-inline: 16px; }
    .welcome-strip, .admin-welcome { min-height: 205px; padding: 26px 22px; border-radius: 18px; }
    .orbit-badge { display: none; }
    .workbench-cards { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .data-panel, .invite-create, .settings-panel, .novel-compose, .image-studio { border-radius: 16px; }
    .panel-heading { align-items: stretch; flex-direction: column; }
    .search-form input { width: 100%; }
    .novel-toolbar { align-items: stretch; flex-direction: column; }
    .novel-model-state { flex-wrap: wrap; }
    .mode-switch { justify-content: space-between; }
    .mode-switch select { flex: 1; }
    .story-track { padding: 0; }
    .story-track b { font-size: 9px; }
    .novel-input-panel, .novel-output-panel, .image-studio-toolbar, .image-compose-panel, .image-gallery-panel { padding: 22px 18px; }
    .guide-route { grid-template-columns: 1fr; }
    .guide-route article + article { padding-left: 0; border-left: 0; border-top: 1px solid var(--dashboard-line); }
    .auth-card { padding: 24px 18px; border-radius: 18px; }
}

@media (max-width: 480px) {
    .dashboard-topbar { padding-inline: 14px; }
    .dashboard-content { padding: 20px 12px 48px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { min-height: 110px; padding: 16px; }
    .stat-card strong { font-size: 26px; }
    .topbar-actions { gap: 5px; }
    .novel-model-state strong { max-width: 62vw; }
    .novel-model-state .model-settings-button { margin-left: 21px; }
    .model-modal-backdrop, .onboarding-backdrop { padding: 10px; }
    .model-modal, .onboarding-dialog { padding: 22px 17px; border-radius: 17px; }
    .model-fetch-row { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .side-nav a,
    .workbench-card,
    .workbench-card::after {
        transition: none !important;
    }
}
