* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    color: #333;
    font-size: 14px;
}

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container { width: 100%; max-width: 420px; padding: 20px; }

.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.auth-logo { text-align: center; margin-bottom: 30px; }
.logo-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.auth-logo h1 { font-size: 28px; color: #333; margin-bottom: 4px; }
.auth-logo p { color: #888; font-size: 14px; }

.auth-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 24px;
}
.tab-btn {
    flex: 1;
    padding: 12px 0;
    background: none;
    border: none;
    font-size: 16px;
    color: #888;
    cursor: pointer;
    position: relative;
    transition: color 0.3s;
}
.tab-btn.active { color: #667eea; font-weight: 600; }
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: #667eea;
    border-radius: 2px;
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-size: 14px;
}
.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}
.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.form-error {
    color: #e74c3c;
    font-size: 13px;
    margin-bottom: 12px;
    min-height: 18px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(102,126,234,0.4); }
.btn-primary:active { transform: translateY(0); }

.top-bar {
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.top-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo-icon { font-size: 28px; }
.brand-name { font-size: 20px; font-weight: 700; color: #333; }

.user-info { display: flex; align-items: center; gap: 16px; color: #555; }

/* 用户名下拉菜单 */
.user-dropdown { position: relative; }
.user-dropdown-toggle {
    background: none; border: 1px solid #e0e0e0; border-radius: 6px;
    padding: 6px 12px; cursor: pointer; font-size: 14px; color: #555;
}
.user-dropdown-toggle:hover { background: #f5f7fa; border-color: #c7d8ff; }
.user-dropdown-toggle .caret { font-size: 11px; color: #999; margin-left: 2px; }
.user-dropdown-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 4px);
    min-width: 140px; background: #fff; border: 1px solid #e8e8e8;
    border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    padding: 4px 0; z-index: 100;
}
.user-dropdown-menu.show { display: block; }
.user-dropdown-item {
    display: block; width: 100%; padding: 8px 16px; box-sizing: border-box;
    text-decoration: none; color: #555; font-size: 14px; cursor: pointer;
    background: none; border: none; text-align: left;
}
.user-dropdown-item:hover { background: #f5f7fa; color: #667eea; }
.nav-links { display: flex; gap: 8px; }
.nav-link {
    padding: 8px 16px;
    text-decoration: none;
    color: #666;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s;
}
.nav-link:hover { background: #f5f7fa; color: #667eea; }
.nav-link.active {
    background: #667eea;
    color: #fff;
}
.btn-link {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 14px;
}
.btn-link:hover { text-decoration: underline; }

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h2 { font-size: 22px; color: #333; }

.search-box { display: flex; gap: 10px; }
.search-box input {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 240px;
}
.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-secondary {
    padding: 8px 18px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    transition: all 0.2s;
}
.btn-secondary:hover { border-color: #667eea; color: #667eea; }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.table-wrap {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow: hidden;
    overflow-x: auto;
}

.stock-table, .kline-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

.stock-table th, .kline-table th {
    background: #fafbfc;
    padding: 12px 14px;
    text-align: right;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.stock-table th:first-child, .stock-table td:first-child,
.stock-table th:nth-child(2), .stock-table td:nth-child(2) { text-align: left; }
.kline-table th:first-child, .kline-table td:first-child { text-align: left; }

.stock-table td, .kline-table td {
    padding: 11px 14px;
    text-align: right;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    white-space: nowrap;
}

.stock-table tbody tr:hover { background: #f5f8ff; cursor: pointer; }

.stock-table .code { color: #667eea; font-weight: 500; }
.stock-table .name { color: #333; font-weight: 500; }

.stock-table th[data-sort] { cursor: pointer; position: relative; padding-right: 24px; }
.stock-table th[data-sort]:hover { background: #f5f7fa; }
.stock-table th[data-sort]::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}
.stock-table th.sort-asc::after {
    border-bottom: 4px solid #999;
}
.stock-table th.sort-desc::after {
    border-top: 4px solid #999;
}

.up { color: #e74c3c; }
.down { color: #27ae60; }

.favorite-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #ccc;
    transition: color 0.2s;
    padding: 0;
    line-height: 1;
}
.favorite-btn:hover { color: #f39c12; }
.favorite-btn.favorited { color: #f39c12; }

.favorite-btn-detail {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #666;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.favorite-btn-detail:hover {
    border-color: #f39c12;
    color: #f39c12;
}
.favorite-btn-detail.favorited {
    background: #fef9e7;
    border-color: #f39c12;
    color: #f39c12;
}

.loading {
    text-align: center !important;
    color: #999;
    padding: 30px !important;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}

.page-jump {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-jump input {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.page-size {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-size select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    min-width: 60px;
}

.page-size select:focus {
    outline: none;
    border-color: #667eea;
}

.detail-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}
.detail-price { font-size: 48px; font-weight: 700; line-height: 1; }
.detail-change { font-size: 18px; font-weight: 600; }
.detail-change div:last-child { font-size: 15px; margin-top: 4px; font-weight: 500; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 6px;
}
.detail-item span { color: #888; font-size: 13px; }
.detail-item strong { font-size: 18px; font-weight: 600; color: #333; }

.kline-section {
    background: #fff;
    border-radius: 8px;
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.section-header h3 { font-size: 18px; color: #333; }

/* 股票详情页-所属板块标签 */
.sector-tags { display: flex; flex-direction: column; gap: 12px; }
.sector-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sector-group-label {
    display: inline-block; min-width: 36px; padding: 2px 8px; border-radius: 4px;
    background: #f0f2f5; color: #666; font-size: 12px; text-align: center;
}
.sector-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 14px; text-decoration: none;
    font-size: 13px; background: #eef4ff; color: #4a7afe; border: 1px solid #c7d8ff;
    transition: all 0.15s;
}
.sector-tag:hover { background: #667eea; color: #fff; border-color: #667eea; }
.sector-tag.up { background: #fff0f0; color: #e74c3c; border-color: #ffd5d5; }
.sector-tag.up:hover { background: #e74c3c; color: #fff; border-color: #e74c3c; }
.sector-tag.down { background: #f0fff4; color: #27ae60; border-color: #d5ffe0; }
.sector-tag.down:hover { background: #27ae60; color: #fff; border-color: #27ae60; }
.sector-tag-pct { font-size: 11px; opacity: 0.85; }

.period-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.period-btn {
    padding: 6px 14px;
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    transition: all 0.2s;
}
.period-btn:hover { background: #e8e8e8; }
.period-btn.active {
    background: #667eea;
    color: #fff;
}

.kline-chart {
    width: 100%;
    height: 520px;
    display: none;
}

.kline-loading {
    text-align: center;
    color: #999;
    padding: 60px 0;
    font-size: 14px;
}

@media (max-width: 768px) {
    .detail-grid { grid-template-columns: repeat(2, 1fr); }
    .search-box input { width: 150px; }
    .auth-card { padding: 30px 20px; }
}

/* ===== 板块行情页面 ===== */
.sector-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.sector-tab {
    padding: 8px 24px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.sector-tab:hover {
    background: #f0f0f0;
}

.sector-tab.active {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.sector-table .sector-name {
    font-weight: 600;
    color: #333;
}

.sector-table .leader-cell {
    line-height: 1.4;
}

.sector-table .leader-name {
    display: block;
    font-weight: 500;
    color: #333;
}

.sector-table .leader-code {
    display: block;
    font-size: 12px;
    color: #999;
}

.sector-table tbody tr {
    cursor: pointer;
}

.sector-table tbody tr:hover {
    background: #f5f8ff;
}
