/*
 * 大王山性能解耦（P2）样式入口：
 * 先建立独立静态样式挂点，后续逐步把模板内联样式迁移到此文件。
 */

/* ======================================================================= */
/*  Dawangshan Dark Cockpit · v2 shell scope                                */
/*  Route-owned skin for /settings/dawangshan only.                         */
/* ======================================================================= */
html.dws-dark-shell {
    color-scheme: dark;
}

html.dws-dark-shell body {
    background:
        radial-gradient(circle at 50% 12%, rgba(88, 28, 135, 0.26), transparent 32%),
        #050508;
}

html.dws-dark-shell .global-nav {
    height: 56px;
    padding: 0 18px;
    background:
        linear-gradient(90deg, rgba(8, 6, 18, 0.96), rgba(22, 16, 42, 0.94) 50%, rgba(8, 6, 18, 0.96)) !important;
    border-bottom: 1px solid rgba(167, 139, 250, 0.18);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.36), inset 0 -1px 0 rgba(255, 255, 255, 0.03);
    color: #e9d5ff;
    backdrop-filter: blur(18px) saturate(1.15);
}

html.dws-dark-shell .nav-logo {
    color: #f8fafc !important;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-shadow: 0 0 18px rgba(167, 139, 250, 0.34);
}

html.dws-dark-shell .nav-menu {
    gap: 4px;
}

html.dws-dark-shell .nav-item {
    height: 36px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: rgba(203, 213, 225, 0.78) !important;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    opacity: 1 !important;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

html.dws-dark-shell .nav-item:hover {
    background: rgba(139, 92, 246, 0.16) !important;
    border-color: rgba(167, 139, 250, 0.24);
    color: #f8fafc !important;
    box-shadow: 0 0 18px rgba(139, 92, 246, 0.12);
}

html.dws-dark-shell .nav-item.active {
    background: rgba(139, 92, 246, 0.24) !important;
    border-color: rgba(196, 181, 253, 0.34);
    color: #f5f3ff !important;
}

html.dws-dark-shell .nav-logo::before,
html.dws-dark-shell .nav-item::before {
    background:
        radial-gradient(circle at 18% 0%, rgba(192, 132, 252, 0.18), transparent 38%),
        rgba(12, 10, 24, 0.96) !important;
    border: 1px solid rgba(167, 139, 250, 0.24) !important;
    border-radius: 10px !important;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.46), 0 0 26px rgba(139, 92, 246, 0.12) !important;
    color: rgba(226, 232, 240, 0.94) !important;
    font-size: 12px !important;
    font-weight: 560;
    letter-spacing: 0.01em;
    backdrop-filter: blur(14px) saturate(1.12);
}

html.dws-dark-shell .nav-logo::after,
html.dws-dark-shell .nav-item::after {
    border-bottom-color: rgba(12, 10, 24, 0.96) !important;
    filter: drop-shadow(0 -1px 0 rgba(167, 139, 250, 0.24));
}

html.dws-dark-shell .nav-dropdown-trigger,
html.dws-dark-shell .nav-dropdown-trigger:hover,
html.dws-dark-shell .nav-dropdown-trigger.active {
    border-color: transparent !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: rgba(203, 213, 225, 0.78) !important;
    box-shadow: none !important;
}

html.dws-dark-shell .nav-dropdown-trigger:hover,
html.dws-dark-shell .nav-dropdown-trigger.active {
    color: #f8fafc !important;
}

html.dws-dark-shell .nav-dropdown-menu {
    padding-top: 9px;
}

html.dws-dark-shell .nav-dropdown-menu-inner {
    min-width: 168px;
    overflow: hidden;
    border: 1px solid rgba(167, 139, 250, 0.22);
    border-radius: 14px;
    background:
        radial-gradient(circle at 14% 0%, rgba(192, 132, 252, 0.18), transparent 36%),
        rgba(12, 10, 24, 0.96);
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.52), 0 0 36px rgba(139, 92, 246, 0.12);
    backdrop-filter: blur(18px) saturate(1.18);
}

html.dws-dark-shell .nav-dropdown-item {
    color: rgba(226, 232, 240, 0.88);
    font-size: 12px;
    font-weight: 560;
    line-height: 1.25;
    border-bottom: 1px solid rgba(167, 139, 250, 0.08);
}

html.dws-dark-shell .nav-dropdown-item:last-child {
    border-bottom: 0;
}

html.dws-dark-shell .nav-dropdown-item:hover,
html.dws-dark-shell .nav-dropdown-item.active {
    background: rgba(139, 92, 246, 0.16);
    color: #ffffff;
}

html.dws-dark-shell .nav-settings-btn {
    height: 36px !important;
    padding: 0 11px !important;
    border: 1px solid rgba(167, 139, 250, 0.28) !important;
    border-right: 0 !important;
    border-radius: 12px 0 0 12px !important;
    background:
        radial-gradient(circle at 15% 50%, rgba(192, 132, 252, 0.26), transparent 38%),
        rgba(30, 27, 75, 0.58) !important;
    color: #f5f3ff !important;
    opacity: 1 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.dws-dark-shell .nav-settings-btn svg {
    fill: #c4b5fd !important;
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.32));
}

html.dws-dark-shell #nav-settings-dropdown-btn {
    height: 36px !important;
    width: 26px !important;
    border: 1px solid rgba(167, 139, 250, 0.28) !important;
    border-left: 1px solid rgba(167, 139, 250, 0.14) !important;
    border-radius: 0 12px 12px 0 !important;
    background: rgba(17, 24, 39, 0.78) !important;
    color: #ddd6fe !important;
    opacity: 1 !important;
}

html.dws-dark-shell #nav-settings-dropdown {
    background: rgba(12, 10, 24, 0.96) !important;
    border: 1px solid rgba(167, 139, 250, 0.22) !important;
    border-radius: 14px !important;
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.52), 0 0 36px rgba(139, 92, 246, 0.12) !important;
    backdrop-filter: blur(18px) saturate(1.18);
}

html.dws-dark-shell .nav-dd-group-title {
    color: rgba(167, 139, 250, 0.72) !important;
    background: rgba(139, 92, 246, 0.08) !important;
    border-top-color: rgba(167, 139, 250, 0.10) !important;
    font-size: 10px;
    letter-spacing: 0.08em;
}

html.dws-dark-shell .nav-dd-divider {
    background: rgba(167, 139, 250, 0.12) !important;
}

html.dws-dark-shell .nav-dd-item {
    color: rgba(226, 232, 240, 0.88) !important;
    font-size: 12px !important;
}

html.dws-dark-shell .nav-dd-item:hover {
    background: rgba(139, 92, 246, 0.16) !important;
    color: #ffffff !important;
}

html.dws-dark-shell .nav-dd-token {
    width: 21px;
    height: 21px;
    border-color: rgba(167, 139, 250, 0.24) !important;
    border-radius: 8px !important;
    background: rgba(30, 27, 75, 0.66) !important;
    color: #ddd6fe !important;
    font-size: 10px !important;
    box-shadow: inset 0 0 10px rgba(139, 92, 246, 0.08);
}

html.dws-dark-shell #ko-nav-mail svg {
    fill: #c4b5fd !important;
    opacity: 1 !important;
}

html.dws-dark-shell #nav-user-toggle {
    background: rgba(15, 23, 42, 0.78) !important;
    border-color: rgba(167, 139, 250, 0.34) !important;
    color: #f8fafc !important;
    opacity: 1 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 18px rgba(139, 92, 246, 0.10);
}

html.dws-dark-shell #nav-user-toggle:hover {
    background: rgba(30, 27, 75, 0.82) !important;
    border-color: rgba(196, 181, 253, 0.48) !important;
}

html.dws-dark-shell #nav-user-name-chip {
    color: #f8fafc !important;
    font-weight: 650;
}

html.dws-dark-shell #nav-user-role-pill {
    border: 1px solid rgba(196, 181, 253, 0.30) !important;
    background: rgba(139, 92, 246, 0.22) !important;
    color: #ddd6fe !important;
    border-radius: 999px !important;
    font-size: 10px !important;
    font-weight: 750 !important;
}

html.dws-dark-shell #login-link a {
    color: #f8fafc !important;
    opacity: 1 !important;
}

/* ── 用户卡片下拉（▾管理员小三角）暗色主题 ── */
html.dws-dark-shell #nav-user-dd {
    background: rgba(12, 10, 24, 0.96) !important;
    border-color: rgba(167, 139, 250, 0.22) !important;
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.52), 0 0 36px rgba(139, 92, 246, 0.12) !important;
}

html.dws-dark-shell #nav-user-dd > div:first-child {
    border-bottom-color: rgba(167, 139, 250, 0.10) !important;
}

html.dws-dark-shell #nav-user-name-full {
    color: #f1f5f9 !important;
}

html.dws-dark-shell #nav-user-email-line {
    color: rgba(148, 163, 184, 0.80) !important;
}

html.dws-dark-shell #nav-user-role-chip {
    background: rgba(139, 92, 246, 0.18) !important;
    color: #ddd6fe !important;
}

html.dws-dark-shell #nav-viewas-section > div[style*="background:#e6e4df"] {
    background: rgba(167, 139, 250, 0.12) !important;
}

html.dws-dark-shell #nav-viewas-section div[style*="color:#6f6d68"] {
    color: rgba(167, 139, 250, 0.72) !important;
}

html.dws-dark-shell #nav-user-logout-wrap > div[style*="background:#e6e4df"] {
    background: rgba(167, 139, 250, 0.12) !important;
}

html.dws-dark-shell #nav-user-dd .nav-dd-item[style*="color:#dc2626"] {
    color: #fca5a5 !important;
}

/* ======================================================================= */
/*  Dawangshan icon, capsule and typography primitives                      */
/* ======================================================================= */
#dws-fullscreen.dws-dark-cockpit-v2 {
    --dws-pill-neutral-bg: rgba(30, 41, 59, 0.45);
    --dws-pill-neutral-border: rgba(148, 163, 184, 0.28);
    --dws-pill-active-bg: rgba(139, 92, 246, 0.18);
    --dws-pill-active-border: rgba(196, 181, 253, 0.36);
    --dws-pill-admin-bg: rgba(139, 92, 246, 0.24);
    --dws-pill-view-bg: rgba(14, 165, 233, 0.14);
    --dws-pill-view-border: rgba(56, 189, 248, 0.32);
}

#dws-fullscreen .dws-icon-token {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    line-height: 1;
    vertical-align: -0.08em;
}

#dws-fullscreen .dws-icon-token--decorative {
    font-size: var(--fs-strong);
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.36));
}

#dws-fullscreen .dws-icon-token--mode {
    font-size: var(--fs-primary);
}

#dws-fullscreen .dws-icon-token--status {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

#dws-fullscreen .dws-pill,
#dws-fullscreen .dws-chip,
#dws-fullscreen .dws-action-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    max-width: 100%;
    border-radius: 999px;
    border: 1px solid var(--dws-pill-neutral-border);
    background: var(--dws-pill-neutral-bg);
    color: var(--text-primary);
    font-size: var(--fs-label);
    font-weight: var(--fw-medium);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#dws-fullscreen .dws-pill {
    min-height: 20px;
    padding: 2px 8px;
}

#dws-fullscreen .dws-chip {
    min-height: 18px;
    padding: 1px 7px;
    font-size: var(--fs-micro);
}

#dws-fullscreen .dws-pill--active,
#dws-fullscreen .dws-chip--active {
    border-color: var(--dws-pill-active-border);
    background: var(--dws-pill-active-bg);
    color: #ddd6fe;
}

#dws-fullscreen .dws-pill--ok,
#dws-fullscreen .dws-chip--ok {
    border-color: rgba(74, 222, 128, 0.35);
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

#dws-fullscreen .dws-pill--watch,
#dws-fullscreen .dws-chip--watch {
    border-color: rgba(251, 191, 36, 0.42);
    background: rgba(245, 158, 11, 0.13);
    color: #fde68a;
}

#dws-fullscreen .dws-pill--alert,
#dws-fullscreen .dws-chip--alert {
    border-color: rgba(248, 113, 113, 0.46);
    background: rgba(239, 68, 68, 0.13);
    color: #fecaca;
}

#dws-fullscreen .dws-pill--muted,
#dws-fullscreen .dws-chip--muted {
    border-color: rgba(100, 116, 139, 0.34);
    background: rgba(15, 23, 42, 0.52);
    color: var(--text-secondary);
}

#dws-fullscreen .dws-pill--admin,
#dws-fullscreen .dws-chip--admin {
    border-color: rgba(196, 181, 253, 0.30);
    background: var(--dws-pill-admin-bg);
    color: #e9d5ff;
}

#dws-fullscreen .dws-pill--view-as,
#dws-fullscreen .dws-chip--view-as {
    border-color: var(--dws-pill-view-border);
    background: var(--dws-pill-view-bg);
    color: #bae6fd;
}

#dws-fullscreen #dws-celestial-btn.dws-action-pill,
#dws-fullscreen #dws-fs-btn.dws-action-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(167, 139, 250, 0.32);
    background:
        radial-gradient(circle at 20% 50%, rgba(192, 132, 252, 0.20), transparent 42%),
        rgba(15, 23, 42, 0.70);
    color: #ddd6fe;
    box-shadow: 0 0 18px rgba(139, 92, 246, 0.10);
    font-size: var(--fs-label);
    font-weight: 700;
}

#dws-fullscreen #dws-celestial-btn.dws-action-pill:hover,
#dws-fullscreen #dws-fs-btn.dws-action-pill:hover {
    background: rgba(139, 92, 246, 0.24);
    border-color: rgba(196, 181, 253, 0.48);
}

#dws-fullscreen #dws-fs-btn.dws-action-pill--icon {
    width: 32px;
    padding: 0;
    font-size: var(--fs-primary);
}

#dws-fullscreen {
    contain: layout paint style;
}

#dws-bottom-stack {
    will-change: transform, opacity;
}

/* 卡片壳先出现，细节稍后填充 */
.galaxy-card-shell,
.dws-panel-shell {
    min-height: 48px;
}

.kf-pulse-status-pill {
    display: inline-flex;
    align-items: center;
    max-width: 180px;
    min-height: 20px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    font-size: var(--fs-label);
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kf-pulse-status-pill--ok {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
}

.kf-pulse-status-pill--watch {
    border-color: rgba(251, 191, 36, 0.48);
    background: rgba(251, 191, 36, 0.14);
    color: #fde68a;
}

.kf-pulse-status-pill--alert {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(248, 113, 113, 0.14);
    color: #fecaca;
}

.kf-pulse-status-pill--unknown {
    border-color: rgba(167, 139, 250, 0.42);
    background: rgba(167, 139, 250, 0.13);
    color: #ddd6fe;
}

.kf-pulse-growth-summary {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: var(--fs-label);
    line-height: 1.35;
}

/* ======================================================================= */
/*  Compass Waterfall — 指南针瀑布图卡片 (ADR-0199 Wave 5c-dws)              */
/* ======================================================================= */

#dws-compass-waterfall-card {
    position: relative;
    margin-top: 8px;
}

.cwf-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.cwf-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
}

.cwf-status-text {
    font-size: var(--fs-label);
    color: var(--text-muted);
    margin-left: auto;
}

.cwf-empty {
    text-align: center;
    padding: 24px 0;
    color: var(--text-muted);
    font-size: var(--fs-label);
}

.cwf-empty-icon {
    font-size: 28px;
    margin-bottom: 6px;
    opacity: 0.5;
}

/* ── Chain row ─────────────────────────────────────── */
.cwf-chain {
    margin-bottom: 10px;
    padding: 6px 8px;
    border: 1px solid rgba(167, 139, 250, 0.12);
    border-radius: 6px;
    background: rgba(30, 27, 75, 0.3);
}

.cwf-chain-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: var(--fs-label);
}

.cwf-chain-id {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: #c4b5fd;
    font-weight: 600;
}

.cwf-chain-stats {
    display: flex;
    gap: 8px;
    margin-left: auto;
    font-size: 10px;
}

.cwf-stat--ok { color: #86efac; }
.cwf-stat--fail { color: #fca5a5; }

.cwf-chain-count {
    color: var(--text-muted);
}

/* ── Timeline ──────────────────────────────────────── */
.cwf-timeline {
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(167, 139, 250, 0.2) transparent;
}

.cwf-timeline::-webkit-scrollbar { height: 4px; }
.cwf-timeline::-webkit-scrollbar-thumb { background: rgba(167, 139, 250, 0.25); border-radius: 2px; }

.cwf-anchor {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: default;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.cwf-anchor:hover {
    transform: scale(1.25);
    z-index: 2;
}

.cwf-anchor-label {
    font-size: 9px;
    color: var(--text-muted);
    max-width: 52px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* ── Gap indicator ─────────────────────────────────── */
.cwf-gap {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    min-width: 20px;
}

.cwf-gap-line {
    display: block;
    width: 6px;
    height: 1px;
    background: rgba(167, 139, 250, 0.3);
}

.cwf-gap-label {
    font-size: 8px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Chain footer ──────────────────────────────────── */
.cwf-chain-footer {
    margin-top: 3px;
    text-align: right;
}

.cwf-ts {
    font-size: 9px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
