@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700&family=Noto+Sans+TC:wght@400;500;700;900&display=swap');

:root {
    --neo-bg: #04070f;
    --neo-bg-2: #070d1a;
    --neo-surface: rgba(10, 18, 34, 0.86);
    --neo-surface-2: rgba(14, 25, 45, 0.9);
    --neo-border: rgba(148, 163, 184, 0.2);
    --neo-border-strong: rgba(34, 211, 238, 0.55);
    --neo-text: #e2ecff;
    --neo-muted: #98abd0;
    --neo-cyan: #22d3ee;
    --neo-blue: #3b82f6;
    --neo-indigo: #6366f1;
    --neo-success: #22c55e;
    --neo-warning: #f59e0b;
    --neo-danger: #ef4444;
    --neo-radius: 18px;
    --neo-shadow: 0 20px 48px rgba(2, 8, 23, 0.52);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(34, 211, 238, 0.6) rgba(8, 15, 30, 0.8);
}

*::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

*::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(34, 211, 238, 0.9), rgba(59, 130, 246, 0.9));
}

*::-webkit-scrollbar-track {
    background: rgba(8, 15, 30, 0.85);
}

body.app-dark {
    font-family: 'Noto Sans TC', 'Orbitron', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    background:
        radial-gradient(1100px 720px at 95% -10%, rgba(34, 211, 238, 0.15), transparent 65%),
        radial-gradient(1000px 620px at -5% 20%, rgba(99, 102, 241, 0.22), transparent 70%),
        linear-gradient(180deg, var(--neo-bg) 0%, var(--neo-bg-2) 44%, #040814 100%);
    color: var(--neo-text);
    min-height: 100vh;
    overflow-x: hidden;
}

body.app-dark::before,
body.app-dark::after {
    content: '';

body.app-dark .header::after {
    content: 'STATUS: ONLINE  |  GRID: STABLE';
    position: absolute;
    top: 10px;
    right: 16px;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    letter-spacing: 0.12em;
    color: rgba(167, 243, 208, 0.9);
    background: rgba(6, 18, 30, 0.65);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 999px;
    padding: 4px 10px;
}
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

body.app-dark.message-system .header h1::after,
body.app-dark.reports-system .header h1::after,
body.app-dark.announcement-system .header h1::after {
    margin-left: 10px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    color: rgba(34, 211, 238, 0.9);
    vertical-align: middle;
}

body.app-dark.message-system .header h1::after {
    content: 'MONITOR';
}

body.app-dark.reports-system .header h1::after {
    content: 'REVIEW';
}

body.app-dark.announcement-system .header h1::after {
    content: 'BROADCAST';
}

body.app-dark::before {
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.055) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: radial-gradient(circle at 50% 15%, rgba(0, 0, 0, 0.8), transparent 84%);
}

body.app-dark::after {
    background: linear-gradient(90deg, transparent 0%, rgba(34, 211, 238, 0.05) 48%, transparent 52%, transparent 100%);
    transform: translateX(-110%);
    animation: scan-pass 10s linear infinite;
}

@keyframes scan-pass {
    to {
        transform: translateX(110%);
    }
}

body.app-dark .container {
    width: min(1700px, calc(100% - 28px));
    margin: 12px auto 34px;
    padding: 0;
    display: grid;
    gap: 16px;
    animation: dashboard-enter 0.55s ease-out;
}

@keyframes dashboard-enter {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.app-dark .main-navbar {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    min-height: 76px;
    padding: 10px 16px;
    position: sticky;
    top: 10px;
    z-index: 110;
    border-radius: 20px;
    border: 1px solid var(--neo-border-strong);
    background:
        linear-gradient(130deg, rgba(8, 16, 31, 0.88), rgba(13, 26, 49, 0.9)),
        radial-gradient(circle at top right, rgba(34, 211, 238, 0.2), transparent 45%);
    box-shadow: 0 20px 38px rgba(2, 8, 23, 0.55);
    backdrop-filter: blur(20px);
}

body.app-dark .main-navbar::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(90deg, rgba(34, 211, 238, 0.06), rgba(34, 211, 238, 0.5), rgba(59, 130, 246, 0.55), rgba(34, 211, 238, 0.06));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

body.app-dark .navbar-brand {
    min-width: 210px;
    display: flex;
    align-items: center;
    gap: 10px;
}

body.app-dark .navbar-brand::before {
    content: none;
    display: none;
}

body.app-dark .user-avatar {
    border: 2px solid rgba(34, 211, 238, 0.6);
    box-shadow: 0 0 16px rgba(34, 211, 238, 0.3);
}

body.app-dark .user-name {
    color: #f5f9ff;
    font-weight: 700;
}

body.app-dark .user-status {
    color: #86efac;
}

body.app-dark .navbar-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 8px;
    max-width: none;
}

body.app-dark .nav-btn {
    min-height: 46px;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(9, 18, 33, 0.84);
    color: #bdd2f5;
    font-weight: 700;
    letter-spacing: 0.03em;
}

body.app-dark .nav-btn:hover:not(.active) {
    transform: translateY(-2px);
    background: rgba(13, 31, 53, 0.95);
    border-color: rgba(34, 211, 238, 0.72);
    color: #ecfeff;
}

body.app-dark .nav-btn.active {
    color: #ecfeff;
    border-color: rgba(34, 211, 238, 0.9);
    background: linear-gradient(135deg, rgba(7, 44, 69, 0.95), rgba(30, 64, 175, 0.92));
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.35), 0 12px 28px rgba(2, 6, 23, 0.4);
}

body.app-dark .navbar-actions {
    justify-self: end;
}

body.app-dark .logout-btn {
    border-radius: 12px;
    border: 1px solid rgba(248, 113, 113, 0.6);
    background: linear-gradient(135deg, #7f1d1d, #b91c1c);
    box-shadow: 0 8px 16px rgba(127, 29, 29, 0.35);
}

body.app-dark .header {
    margin: 0;
    border-radius: 20px;
    border: 1px solid rgba(34, 211, 238, 0.24);
    background: linear-gradient(135deg, rgba(8, 15, 30, 0.9), rgba(14, 28, 50, 0.92));
    box-shadow: var(--neo-shadow);
    padding: 24px 26px;
    position: relative;
    overflow: hidden;
}

body.app-dark .header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(500px 180px at 90% -10%, rgba(34, 211, 238, 0.26), transparent 70%);
    pointer-events: none;
}

body.app-dark .header h1 {
    font-family: 'Orbitron', 'Noto Sans TC', sans-serif;
    text-align: left;
    color: #eaf4ff;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: clamp(1.45rem, 2.2vw, 2.2rem);
    text-shadow: none;
}

body.app-dark .header p {
    margin-top: 6px;
    text-align: left;
    color: var(--neo-muted);
    font-size: 0.95rem;
}

body.app-dark .content-tabs .tab-container,
body.app-dark .feature-tabs {
    border-radius: 16px;
    border: 1px solid rgba(34, 211, 238, 0.22);
    background: rgba(8, 15, 30, 0.84);
    box-shadow: 0 14px 30px rgba(2, 8, 23, 0.38);
}

body.app-dark .tab-button,
body.app-dark .content-tabs .tab-button,
body.app-dark .feature-tabs .tab-btn {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(10, 21, 38, 0.76);
    color: #b7ccef;
    font-weight: 700;
}

body.app-dark .tab-button:hover:not(.active),
body.app-dark .content-tabs .tab-button:hover:not(.active),
body.app-dark .feature-tabs .tab-btn:hover:not(.active) {
    border-color: rgba(34, 211, 238, 0.68);
    background: rgba(12, 31, 53, 0.9);
    color: #e0f2fe;
}

body.app-dark .tab-button.active,
body.app-dark .content-tabs .tab-button.active,
body.app-dark .feature-tabs .tab-btn.active {
    color: #ecfeff;
    border-color: rgba(34, 211, 238, 0.85);
    background: linear-gradient(135deg, rgba(8, 47, 73, 0.92), rgba(37, 99, 235, 0.88));
    box-shadow: 0 10px 24px rgba(2, 8, 23, 0.45);
}

body.app-dark .card {
    background: linear-gradient(145deg, var(--neo-surface), var(--neo-surface-2));
    border-radius: var(--neo-radius);
    border: 1px solid var(--neo-border);
    box-shadow: var(--neo-shadow);
    color: var(--neo-text);
    position: relative;
    overflow: hidden;
}

body.app-dark .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(34, 211, 238, 0), rgba(34, 211, 238, 0.7), rgba(59, 130, 246, 0.8), rgba(34, 211, 238, 0));
    opacity: 0.9;
}

body.app-dark .card h2,
body.app-dark .section-title {
    color: #d9f2ff;
    letter-spacing: 0.02em;
}

body.app-dark .form-group label {
    color: #a4b7d8;
    font-weight: 600;
}

body.app-dark .form-control,
body.app-dark input,
body.app-dark select,
body.app-dark textarea {
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    background: rgba(4, 11, 22, 0.78);
    color: #deecff;
}

body.app-dark .form-control:focus,
body.app-dark input:focus,
body.app-dark select:focus,
body.app-dark textarea:focus {
    border-color: rgba(34, 211, 238, 0.88);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

body.app-dark .btn {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    font-weight: 700;
}

body.app-dark .btn-primary {
    border-color: rgba(34, 211, 238, 0.6);
    background: linear-gradient(135deg, #0e7490, #2563eb);
    box-shadow: 0 10px 20px rgba(14, 116, 144, 0.35);
}

body.app-dark .btn-primary:hover:not(:disabled) {
    filter: brightness(1.05);
    box-shadow: 0 14px 24px rgba(14, 116, 144, 0.45);
}

body.app-dark .btn-secondary {
    background: rgba(10, 18, 32, 0.85);
    color: #d9e8ff;
}

body.app-dark .stat-card {
    border: 1px solid rgba(125, 211, 252, 0.45);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(14, 116, 144, 0.92), rgba(37, 99, 235, 0.9));
}

body.app-dark .message-item,
body.app-dark .forum-item,
body.app-dark .report-card,
body.app-dark .announcement-card,
body.app-dark .schedule-card,
body.app-dark .channel-card,
body.app-dark .log-item {
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(145deg, rgba(8, 15, 27, 0.96), rgba(12, 24, 42, 0.95));
}

body.app-dark .modal,
body.app-dark .bot-analysis-modal {
    backdrop-filter: blur(8px);
}

body.app-dark .modal-content,
body.app-dark .bot-analysis-container,
body.app-dark .password-modal-content,
body.app-dark .download-progress-content {
    border-radius: 18px;
    border: 1px solid rgba(34, 211, 238, 0.3);
    background: linear-gradient(145deg, rgba(6, 12, 23, 0.97), rgba(12, 24, 43, 0.97));
}

body.app-dark .pagination button {
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(8, 15, 28, 0.86);
    color: #dbeafe;
}

body.app-dark .pagination button:hover:not(:disabled) {
    border-color: rgba(34, 211, 238, 0.7);
    background: rgba(11, 28, 49, 0.94);
}

body.app-dark * {
    transition: background-color 0.24s ease, border-color 0.24s ease, color 0.24s ease, box-shadow 0.26s ease, transform 0.2s ease;
}

@media (max-width: 1200px) {
    body.app-dark .navbar-nav {
        grid-template-columns: repeat(3, minmax(90px, 1fr));
    }
}

@media (max-width: 900px) {
    body.app-dark .container {
        width: calc(100% - 14px);
        gap: 12px;
    }

    body.app-dark .main-navbar {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    body.app-dark .navbar-brand,
    body.app-dark .navbar-actions {
        justify-self: stretch;
    }

    body.app-dark .navbar-nav {
        grid-template-columns: 1fr;
    }

    body.app-dark .header {
        padding: 18px;
    }

    body.app-dark .header h1 {
        font-size: 1.42rem;
    }
}

.shell-grid {
    width: min(1760px, calc(100% - 20px));
    margin: 10px auto 24px;
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 12px;
}

.shell-rail {
    position: sticky;
    top: 10px;
    height: calc(100vh - 20px);
    border: 1px solid rgba(34, 211, 238, 0.34);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(7, 14, 27, 0.94), rgba(10, 20, 37, 0.94));
    box-shadow: 0 14px 36px rgba(2, 8, 23, 0.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    gap: 12px;
    z-index: 120;
}

.shell-rail::before {
    content: 'NX';
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(34, 211, 238, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: #a5f3fc;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
}

.rail-link {
    width: 54px;
    min-height: 54px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(10, 20, 36, 0.9);
    color: #bfd4f6;
    display: grid;
    place-items: center;
    text-decoration: none;
    transition: transform 0.22s ease, border-color 0.22s ease, background-color 0.22s ease;
    position: relative;
}

.rail-link .ui-icon {
    width: 1.2em;
    height: 1.2em;
}

.rail-link::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) scale(0.98);
    background: rgba(7, 16, 30, 0.94);
    color: #dff7ff;
    border: 1px solid rgba(34, 211, 238, 0.5);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.rail-link:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.rail-link:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 211, 238, 0.72);
    background: rgba(7, 44, 69, 0.95);
    color: #ecfeff;
}

body.app-dark .card,
body.app-dark .message-item,
body.app-dark .forum-item,
body.app-dark .report-card,
body.app-dark .announcement-card,
body.app-dark .schedule-card,
body.app-dark .channel-card,
body.app-dark .log-item {
    transform-origin: center top;
}

body.app-dark .card:hover,
body.app-dark .message-item:hover,
body.app-dark .forum-item:hover,
body.app-dark .report-card:hover,
body.app-dark .announcement-card:hover,
body.app-dark .schedule-card:hover,
body.app-dark .channel-card:hover,
body.app-dark .log-item:hover {
    border-color: rgba(34, 211, 238, 0.45);
}

.rail-link.active {
    border-color: rgba(34, 211, 238, 0.92);
    background: linear-gradient(135deg, rgba(8, 47, 73, 0.95), rgba(30, 64, 175, 0.92));
    color: #ecfeff;
    box-shadow: 0 10px 24px rgba(2, 8, 23, 0.4);
}

.shell-stage {
    min-width: 0;
}

.stage-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(34, 211, 238, 0.24);
    border-radius: 14px;
    background: rgba(7, 15, 29, 0.78);
    margin-bottom: 10px;
}

.stage-breadcrumb {
    font-size: 12px;
    letter-spacing: 0.1em;
    color: #9cd5ff;
    font-family: 'Orbitron', sans-serif;
}

.stage-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stage-action-btn {
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(10, 22, 39, 0.9);
    color: #dbebff;
    border-radius: 10px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.stage-action-btn:hover {
    border-color: rgba(34, 211, 238, 0.7);
    background: rgba(8, 47, 73, 0.9);
}

.rail-toggle {
    margin-top: auto;
    width: 54px;
    min-height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(10, 20, 36, 0.9);
    color: #bfdbfe;
    cursor: pointer;
}

.rail-toggle:hover {
    border-color: rgba(34, 211, 238, 0.72);
    background: rgba(8, 47, 73, 0.92);
}

body.rail-collapsed .shell-grid {
    grid-template-columns: 68px 1fr;
}

body.rail-collapsed .shell-rail::before {
    width: 34px;
    height: 34px;
    font-size: 10px;
}

body.rail-collapsed .rail-link,
body.rail-collapsed .rail-toggle {
    width: 44px;
    min-height: 44px;
}

body.rail-collapsed .rail-toggle .ui-icon {
    transform: rotate(180deg);
}

.loading.skeleton {
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background:
        linear-gradient(110deg, rgba(15, 23, 42, 0.9) 8%, rgba(30, 41, 59, 0.95) 18%, rgba(15, 23, 42, 0.9) 33%),
        rgba(15, 23, 42, 0.92);
    background-size: 220% 100%;
    color: rgba(191, 219, 254, 0.82);
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    animation: skeleton-shimmer 1.5s linear infinite;
}

@keyframes skeleton-shimmer {
    to {
        background-position: -140% 0;
    }
}

body.app-dark .shell-stage .container {
    width: 100%;
    margin: 0;
}

@media (max-width: 1080px) {
    .shell-grid {
        grid-template-columns: 1fr;
    }

    .shell-rail {
        position: static;
        height: auto;
        flex-direction: row;
        justify-content: center;
        padding: 8px;
    }

    .shell-rail::before {
        margin: 0 8px 0 0;
    }

    .rail-toggle {
        margin-top: 0;
    }

    .stage-topbar {
        flex-direction: column;
        align-items: stretch;
    }

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

    .rail-link::after {
        display: none;
    }
}
