* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif; background: #f8f9fc; color: #333; min-height: 100vh; }

/* 认证页 */
.auth-box { max-width: 400px; margin: 80px auto; background: #fff; padding: 40px; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
.auth-box h1 { text-align: center; color: #6c5ce7; margin-bottom: 30px; font-size: 24px; font-family: 'Playfair Display', serif; font-style: italic; }
.auth-box h2 { color: #333; margin-bottom: 20px; text-align: center; font-size: 18px; font-weight: 500; }
.auth-box input { width: 100%; padding: 12px 16px; margin-bottom: 12px; border: 1px solid #e0e0e0; border-radius: 10px; background: #f8f9fc; color: #333; font-size: 14px; transition: border-color 0.3s; }
.auth-box input:focus { outline: none; border-color: #6c5ce7; background: #fff; }
.auth-box button { width: 100%; padding: 12px; background: #6c5ce7; color: #fff; border: none; border-radius: 10px; font-size: 15px; cursor: pointer; margin-top: 8px; font-weight: 500; transition: background 0.3s; }
.auth-box button:hover { background: #5a4bd1; }
.switch-link { text-align: center; margin-top: 15px; color: #999; font-size: 13px; }
.switch-link a { color: #6c5ce7; text-decoration: none; font-weight: 500; }
.error-msg { color: #e74c3c; text-align: center; margin-top: 10px; min-height: 20px; font-size: 13px; }

/* 主布局 */
.app-layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar { width: 220px; background: #fff; border-right: 1px solid #eee; padding: 20px 0; display: flex; flex-direction: column; position: fixed; height: 100vh; overflow-y: auto; }
.sidebar-logo { padding: 0 20px 20px; border-bottom: 1px solid #f0f0f0; margin-bottom: 15px; }
.sidebar-logo h2 { color: #6c5ce7; font-size: 18px; font-family: 'Playfair Display', serif; font-style: italic; }
.sidebar-nav { flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 12px 20px; cursor: pointer; color: #666; font-size: 14px; transition: all 0.2s; border-left: 3px solid transparent; }
.nav-item:hover { background: #f8f5ff; color: #6c5ce7; }
.nav-item.active { background: #f3f0ff; color: #6c5ce7; border-left-color: #6c5ce7; font-weight: 500; }
.nav-item .icon { font-size: 18px; }
.sidebar-footer { padding: 15px 20px; border-top: 1px solid #f0f0f0; }
.sidebar-footer .user-info { font-size: 12px; color: #999; margin-bottom: 8px; }
.sidebar-footer button { width: 100%; padding: 8px; background: #f8f9fc; color: #666; border: 1px solid #e0e0e0; border-radius: 8px; cursor: pointer; font-size: 13px; }
.sidebar-footer button:hover { background: #eee; }

/* 主内容区 */
.main-content { margin-left: 220px; flex: 1; padding: 30px; min-height: 100vh; overflow-x: hidden; }

/* 顶部栏 */
.top-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 25px; flex-wrap: wrap; }
.top-bar select { padding: 8px 14px; border: 1px solid #e0e0e0; border-radius: 8px; background: #fff; color: #333; font-size: 14px; min-width: 150px; }
.top-bar select:focus { outline: none; border-color: #6c5ce7; }

/* 按钮 */
button, .btn { padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer; background: #6c5ce7; color: #fff; transition: all 0.2s; font-size: 13px; font-weight: 500; }
button:hover { background: #5a4bd1; transform: translateY(-1px); }
.btn-secondary { background: #f0edff; color: #6c5ce7; }
.btn-secondary:hover { background: #e4deff; transform: translateY(-1px); }
.btn-danger { background: #ffe8e8; color: #e74c3c; }
.btn-danger:hover { background: #ffd4d4; transform: translateY(-1px); }
.btn-small { padding: 5px 10px; font-size: 12px; }

/* 卡片 */
.card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.04); margin-bottom: 20px; }
.card h2 { font-size: 18px; color: #333; margin-bottom: 16px; font-weight: 600; }
.card h3 { font-size: 15px; color: #6c5ce7; margin: 16px 0 10px; font-weight: 500; }
.card h4 { font-size: 14px; color: #6c5ce7; margin: 12px 0 8px; font-weight: 500; }

/* 表格 */
table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f0f0f0; }
th { background: #f8f9fc; color: #666; font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover { background: #fafbff; }
td { color: #444; }

/* 表单 */
input, select, textarea { padding: 9px 14px; border: 1px solid #e0e0e0; border-radius: 8px; background: #fff; color: #333; font-size: 13px; transition: border-color 0.3s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #6c5ce7; box-shadow: 0 0 0 3px rgba(108,92,231,0.1); }
textarea { resize: vertical; }

/* 工具类 */
.config-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.config-row label { min-width: 60px; color: #666; font-size: 13px; font-weight: 500; }
.status-on { color: #27ae60; font-weight: 600; font-size: 12px; background: #e8f8f0; padding: 3px 8px; border-radius: 4px; }
.status-off { color: #e74c3c; font-weight: 600; font-size: 12px; background: #fde8e8; padding: 3px 8px; border-radius: 4px; }
.summary-card { background: #f8f9fc; padding: 20px; border-radius: 10px; margin: 12px 0; border: 1px solid #eee; }
.summary-card h4 { color: #6c5ce7; margin-bottom: 10px; }
.matrix-table { overflow: auto; max-width: 100%; max-height: 75vh; scroll-behavior: smooth; }
.matrix-table table { font-size: 12px; min-width: max-content; border-collapse: separate; border-spacing: 0; }
.matrix-table th { white-space: nowrap; border: 1px solid #f0f0f0; padding: 8px 10px; position: sticky; top: 0; background: #f8f9fc; z-index: 2; font-size: 11px; }
.matrix-table td { white-space: nowrap; border: 1px solid #f0f0f0; padding: 8px 10px; }
.matrix-table th:nth-child(-n+4), .matrix-table td:nth-child(-n+4) { position: sticky; background: #fff; z-index: 1; }
.matrix-table th:nth-child(-n+4) { background: #f8f9fc; z-index: 3; }
.matrix-table th:nth-child(4), .matrix-table td:nth-child(4) { border-right: 2px solid #e0e0e0; }
.checkbox-cell { cursor: pointer; transition: background 0.2s; }
.batch-upload-box { background: #f8f5ff; padding: 16px; border-radius: 10px; margin: 16px 0; border: 1px dashed #c4b5fd; }
.batch-upload-box code { background: #ede9fe; padding: 2px 6px; border-radius: 4px; color: #6c5ce7; font-size: 12px; }
.fund-pool { background: linear-gradient(135deg, #6c5ce7, #a29bfe); padding: 20px; border-radius: 12px; margin-bottom: 16px; color: #fff; }
.fund-pool h3 { color: #fff; font-size: 20px; }
.search-box { width: 250px; margin-bottom: 12px; }
.msg-success { color: #27ae60; }
.msg-error { color: #e74c3c; }

/* 面板 */
.panel { display: none; }
.panel.active { display: block; }

/* 下拉菜单 */
.dropdown-menu { display: none; position: absolute; top: 100%; right: 0; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 1000; min-width: 140px; margin-top: 4px; }
.dropdown-menu.show { display: block; }
.dropdown-menu a { display: block; padding: 10px 16px; color: #444; font-size: 13px; cursor: pointer; text-decoration: none; }
.dropdown-menu a:hover { background: #f8f5ff; color: #6c5ce7; }

/* 响应式 */
@media (max-width: 768px) {
    /* 侧边栏变底部导航 */
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 12px; }

    /* 顶部栏 */
    .top-bar { flex-direction: column; align-items: stretch; gap: 8px; }
    .top-bar select { width: 100%; min-width: unset; }
    .top-bar button { width: 48%; font-size: 12px; padding: 7px 10px; }

    /* 卡片 */
    .card { padding: 15px; border-radius: 10px; }
    .card h2 { font-size: 16px; }

    /* 表格通用 */
    table { font-size: 12px; }
    th, td { padding: 7px 8px; }

    /* 表单 */
    .config-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .config-row label { min-width: unset; }
    .config-row input, .config-row select { width: 100%; }
    input, select, textarea { font-size: 14px; padding: 10px 12px; }

    /* 批量输入框 */
    .batch-upload-box { padding: 12px; }
    .search-box { width: 100%; }

    /* AA矩阵 */
    .matrix-table { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
    .matrix-table table { font-size: 11px; }
    .matrix-table th, .matrix-table td { min-width: 50px; padding: 5px 6px; }

    /* 基金池 */
    .fund-pool { padding: 15px; }
    .fund-pool h3 { font-size: 18px; }

    /* 认证页 */
    .auth-box { margin: 30px 15px; padding: 25px 20px; }

    /* 分享页 */
    #view-page > div { padding: 12px !important; }
    #view-page h1 { font-size: 20px; }
    #view-page .view-tabs { flex-wrap: wrap; }

    /* 按钮组在手机上换行 */
    .btn-group-mobile { display: flex; flex-wrap: wrap; gap: 6px; }
}

/* 导航图标 - 用CSS伪元素圆点 */
.nav-item .icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  flex-shrink: 0;
}
.nav-item.active .icon,
.nav-item:hover .icon {
  background: #6c5ce7;
}

/* 矩阵左右滚动浮动按钮 */
.matrix-scroll-btns button {
  position: fixed;
  top: 50%;
  width: 32px;
  height: 32px;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  z-index: 999;
}
.matrix-scroll-btns button:hover { background: #f5f5f5; }
.matrix-scroll-btns .scroll-left { left: 232px; }
.matrix-scroll-btns .scroll-right { right: 20px; }
