/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #0f1923;
    color: #e0e6ed;
    overflow: hidden;  /* 防止 body 滚动，由各区域自行滚动 */
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========== 整体布局 ========== */
.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ========== 左侧固定菜单 ========== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background: linear-gradient(180deg, #1a2736 0%, #0f1923 100%);
    border-right: 1px solid #1e2d3d;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed {
    transform: translateX(-220px);
}

/* 滚动条样式 */
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: #2a3f52;
    border-radius: 2px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    font-size: 18px;
    font-weight: 700;
    color: #00d4aa;
    border-bottom: 1px solid #1e2d3d;
    flex-shrink: 0;
}

.sidebar-header i {
    font-size: 22px;
}

.logo-text {
    letter-spacing: 0;
}

/* ========== 导航菜单 ========== */
.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #8899aa;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(0, 212, 170, 0.08);
    color: #00d4aa;
}

.nav-item.active {
    background: rgba(0, 212, 170, 0.12);
    color: #00d4aa;
    border-left-color: #00d4aa;
    font-weight: 600;
}

.nav-divider {
    height: 1px;
    background: #1e2d3d;
    margin: 8px 16px;
}

/* ========== 侧边栏底部 ========== */
.sidebar-footer {
    padding: 16px 18px;
    border-top: 1px solid #1e2d3d;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #8899aa;
    font-size: 13px;
}

.user-info i {
    font-size: 20px;
    color: #00d4aa;
}

/* ========== 右侧内容区 ========== */
.main-content {
    margin-left: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 0;
}

/* ========== 顶部栏 ========== */
.top-bar {
    height: 56px;
    background: #111d2b;
    border-bottom: 1px solid #1e2d3d;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    flex-shrink: 0;
}

.menu-toggle {
    display: none;  /* 桌面端隐藏，移动端显示 */
    background: none;
    border: none;
    color: #8899aa;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
}

.menu-toggle:hover {
    background: #1e2d3d;
    color: #00d4aa;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: #e0e6ed;
    flex: 1;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 13px;
    color: #8899aa;
}

.market-status i {
    color: #ff4d4d;
    font-size: 8px;
    margin-right: 4px;
}

.market-status.open i {
    color: #00d4aa;
}

.clock {
    font-family: "Courier New", monospace;
    font-size: 14px;
    color: #00d4aa;
}

/* ========== 页面标签栏 ========== */
.tab-bar {
    height: 46px;
    background: #0b1420;
    border-bottom: 1px solid #1e2d3d;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 14px 0;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
}

.tab-bar::-webkit-scrollbar {
    height: 4px;
}

.tab-bar::-webkit-scrollbar-thumb {
    background: #2a3f52;
    border-radius: 2px;
}

.page-tab {
    height: 38px;
    min-width: 118px;
    max-width: 190px;
    border: 1px solid #1e2d3d;
    border-bottom: none;
    border-radius: 7px 7px 0 0;
    background: #162434;
    color: #c0c8d4;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px 0 12px;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.page-tab:hover {
    color: #e0e6ed;
    border-color: #2a3f52;
}

.page-tab.active {
    background: #1b3144;
    color: #00d4aa;
    border-color: #00d4aa;
    box-shadow: inset 0 2px 0 #00d4aa;
}

.page-tab-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
}

.page-tab-close {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    opacity: 0.72;
}

.page-tab-close:hover {
    background: rgba(255, 255, 255, 0.08);
    opacity: 1;
}

.page-tab.fixed .page-tab-close {
    display: none;
}

/* ========== 内容主体（可独立滚动） ========== */
.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #0f1923;
}

/* 内容区滚动条 */
.content-body::-webkit-scrollbar {
    width: 6px;
}
.content-body::-webkit-scrollbar-thumb {
    background: #1e2d3d;
    border-radius: 3px;
}

/* ========== 卡片通用样式 ========== */
.card {
    background: #111d2b;
    border: 1px solid #1e2d3d;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #e0e6ed;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: #00d4aa;
}

/* ========== 指标网格 ========== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: #111d2b;
    border: 1px solid #1e2d3d;
    border-radius: 8px;
    padding: 18px 20px;
    transition: border-color 0.2s;
}

.metric-card:hover {
    border-color: #00d4aa33;
}

.metric-label {
    font-size: 12px;
    color: #8899aa;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #e0e6ed;
    font-family: "Courier New", monospace;
}

.metric-value.up {
    color: #ff4d4d;  /* A股涨=红 */
}

.metric-value.down {
    color: #00c853;  /* A股跌=绿 */
}

.metric-change {
    font-size: 12px;
    margin-top: 6px;
}

.metric-change.up {
    color: #ff4d4d;
}

.metric-change.down {
    color: #00c853;
}

/* ========== 表格通用 ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 12px;
    color: #8899aa;
    border-bottom: 1px solid #1e2d3d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0;
}

.data-table td {
    padding: 12px 14px;
    font-size: 13px;
    border-bottom: 1px solid #111d2b;
    color: #c0c8d4;
}

.data-table tr:hover td {
    background: #1a2736;
}

.ajax-table-wrap {
    position: relative;
}

.table-loading-mask {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(15, 25, 35, 0.72);
    color: #00d4aa;
    font-size: 13px;
    z-index: 5;
}

.ajax-table-wrap.loading .table-loading-mask {
    display: flex;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: #00d4aa;
    color: #0f1923;
}

.btn-primary:hover {
    background: #00eabc;
}

.btn-outline {
    background: transparent;
    color: #00d4aa;
    border: 1px solid #00d4aa55;
}

.btn-outline:hover {
    background: rgba(0, 212, 170, 0.1);
}

.top-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #8899aa;
    font-size: 12px;
}

.logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    color: #8899aa;
    border: 1px solid #1e2d3d;
    background: #0f1923;
    text-decoration: none;
}

.logout-link:hover {
    color: #00d4aa;
    border-color: #00d4aa55;
}

/* ========== 登录页 ========== */
.login-page {
    min-height: 100vh;
    background: #071018;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-panel {
    width: min(420px, 100%);
    background: #0f1923;
    border: 1px solid #1e2d3d;
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.login-brand > i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #00d4aa;
    color: #071018;
    font-size: 22px;
}

.login-brand h1 {
    margin: 0;
    color: #e0e6ed;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 700;
}

.login-brand p {
    margin: 5px 0 0;
    color: #8899aa;
    font-size: 13px;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #2a1a1a;
    border: 1px solid #ff4d4d44;
    color: #ff9999;
    font-size: 13px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: #8899aa;
    font-size: 12px;
}

.login-form input {
    height: 40px;
    background: #071018;
    border: 1px solid #1e2d3d;
    border-radius: 6px;
    color: #e0e6ed;
    font-size: 14px;
    padding: 0 12px;
    outline: none;
}

.login-form input:focus {
    border-color: #00d4aa;
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.14);
}

.login-submit {
    height: 40px;
    justify-content: center;
    margin-top: 4px;
}

/* ========== 系统日志 ========== */
.system-log-select {
    min-width: 128px;
    height: 34px;
    background: #0f1923;
    border: 1px solid #1e2d3d;
    border-radius: 6px;
    color: #c0c8d4;
    font-size: 12px;
    padding: 0 10px;
}

.system-log-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-bottom: 10px;
    color: #8899aa;
    font-size: 12px;
}

.system-log-meta code {
    color: #00d4aa;
}

.system-log-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    color: #8899aa;
    font-size: 12px;
    cursor: pointer;
}

.system-log-live input {
    accent-color: #00d4aa;
}

.system-log-content {
    height: 360px;
    overflow: auto;
    margin: 0;
    padding: 12px;
    background: #071018;
    border: 1px solid #1e2d3d;
    border-radius: 6px;
    color: #c0c8d4;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 18px;
    white-space: pre;
    word-break: normal;
}

/* ========== 空状态占位 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #8899aa;
}

.empty-state i {
    font-size: 48px;
    color: #1e2d3d;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-220px);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .menu-toggle {
        display: block;
    }
    .top-bar {
        padding: 0 14px;
        gap: 10px;
    }
    .top-bar-right {
        gap: 10px;
    }
    .tab-bar {
        height: 42px;
        padding-left: 8px;
        padding-right: 8px;
    }
    .page-tab {
        height: 34px;
        min-width: 96px;
        max-width: 144px;
    }
}
