/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #1B4F8C;
    --primary-light: #2E6FB5;
    --primary-bg: #E8F0FA;
    --accent: #4FC3F7;
    --red: #E53935;
    --red-light: #FFEBEE;
    --green: #43A047;
    --green-light: #E8F5E9;
    --orange: #FB8C00;
    --orange-light: #FFF3E0;
    --text-main: #1A1A2E;
    --text-secondary: #6B7280;
    --text-hint: #9CA3AF;
    --bg: #F5F6FA;
    --card-bg: #FFFFFF;
    --border: #E5E7EB;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(27, 79, 140, 0.12);
    --radius: 14px;
    --radius-sm: 10px;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    height: 100%;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: var(--bg);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.04);
}

/* ==================== 屏幕切换 ==================== */
.screen {
    min-height: 100vh;
    animation: fadeIn 0.3s ease;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== 登录/注册页 ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F5F6FA 100%);
}

.logo-area {
    text-align: center;
    margin-bottom: 36px;
    animation: slideUp 0.5s ease;
}

.logo-icon {
    margin-bottom: 16px;
}

.app-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.app-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.form-card {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    animation: slideUp 0.5s ease 0.1s both;
}

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.text-input {
    width: 100%;
    height: 48px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    font-size: 16px;
    color: var(--text-main);
    background: #FAFBFC;
    transition: all 0.2s;
    outline: none;
}

.text-input:focus {
    border-color: var(--primary-light);
    background: #fff;
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.invite-input {
    letter-spacing: 6px;
    text-transform: uppercase;
    text-align: center;
    font-weight: 600;
    font-size: 20px;
}

.btn-primary {
    width: 100%;
    height: 48px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.btn-primary:active {
    transform: scale(0.98);
    background: var(--primary-light);
}

.link-row {
    text-align: center;
    margin-top: 18px;
}

.link-text {
    font-size: 14px;
    color: var(--primary-light);
    cursor: pointer;
    transition: opacity 0.2s;
}

.link-text:active {
    opacity: 0.6;
}

.disclaimer-mini {
    margin-top: 32px;
    font-size: 12px;
    color: var(--text-hint);
    text-align: center;
}

.invite-hint {
    margin-top: 28px;
    padding: 16px;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    text-align: center;
}

.invite-hint-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
}

.invite-hint-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==================== 主界面导航 ==================== */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 52px;
    background: var(--primary);
    color: #fff;
}

.nav-title {
    font-size: 17px;
    font-weight: 600;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.nav-right:active {
    opacity: 1;
}

/* ==================== 主内容区 ==================== */
.main-content {
    padding: 16px;
}

/* ==================== 分区 ==================== */
.section {
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 0 4px;
}

.section-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.toggle-detail {
    margin-left: auto;
    font-size: 13px;
    color: var(--primary-light);
    cursor: pointer;
    padding: 4px 8px;
}

/* ==================== 卡片 ==================== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.input-row-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.input-row-name {
    font-size: 15px;
    color: var(--text-main);
    font-weight: 500;
}

.input-row-unit {
    font-size: 12px;
    color: var(--text-hint);
}

.number-input {
    width: 110px;
    height: 40px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    text-align: right;
    background: #FAFBFC;
    outline: none;
    transition: all 0.2s;
    -moz-appearance: textfield;
}

.number-input::-webkit-outer-spin-button,
.number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.number-input:focus {
    border-color: var(--primary-light);
    background: #fff;
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.input-hint {
    font-size: 12px;
    color: var(--text-hint);
    margin-top: 8px;
    line-height: 1.4;
}

/* ==================== 滑块 ==================== */
.slider-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.slider {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(27, 79, 140, 0.3);
    transition: transform 0.15s;
}

.slider::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(27, 79, 140, 0.3);
}

.slider-value {
    min-width: 42px;
    text-align: right;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

/* ==================== 合计折现率 ==================== */
.discount-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-bg);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 20px;
}

.discount-label {
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
}

.discount-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

/* ==================== 估值结果 ==================== */
.primary-result {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    text-align: center;
    padding: 28px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 10px;
}

.result-label {
    font-size: 14px;
    opacity: 0.85;
    margin-bottom: 8px;
}

.result-value {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.result-sub {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    opacity: 0.9;
}

.result-sub-value {
    font-weight: 600;
    font-size: 16px;
}

.result-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.result-card-mini {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
    box-shadow: var(--shadow);
}

.mini-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.mini-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

/* ==================== 评价卡片 ==================== */
.evaluation-card {
    padding: 18px 16px;
}

.eval-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.eval-icon {
    font-size: 10px;
    flex-shrink: 0;
}

.eval-label {
    font-size: 15px;
    font-weight: 600;
}

.eval-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.eval-advice {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--bg);
    margin-top: 4px;
}

/* 评价颜色 */
.eval-low { color: var(--red); }
.eval-low .eval-advice { background: var(--red-light); color: var(--red); }
.eval-reasonable { color: var(--orange); }
.eval-reasonable .eval-advice { background: var(--orange-light); color: var(--orange); }
.eval-high { color: var(--green); }
.eval-high .eval-advice { background: var(--green-light); color: var(--green); }

/* ==================== 详情表格 ==================== */
.detail-table {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 4px 0;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.table-header {
    display: flex;
    padding: 12px 16px;
    background: var(--primary-bg);
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
}

.table-header span, .table-footer span {
    text-align: right;
}

.col-year { flex: 1; text-align: left !important; }
.col-profit { width: 90px; }
.col-factor { width: 80px; }
.col-pv { width: 90px; }

#detail-rows .detail-row {
    display: flex;
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

#detail-rows .detail-row:last-child {
    border-bottom: none;
}

.table-footer {
    display: flex;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-bg);
    border-top: 1.5px solid var(--primary-light);
}

.perpetual-row {
    background: #FFF8E1;
    color: var(--orange);
    border-top: none;
}

/* ==================== 免责声明 ==================== */
.disclaimer-section {
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.disclaimer-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.disclaimer-text {
    font-size: 12px;
    color: var(--text-hint);
    line-height: 1.7;
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 9999;
    max-width: 280px;
    text-align: center;
    line-height: 1.5;
    animation: toastIn 0.25s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -40%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

/* ==================== 响应式 ==================== */
@media (min-width: 481px) {
    body {
        background: #E8EAF0;
    }
}

@media (max-width: 480px) {
    .input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .input-row-label {
        flex-shrink: 0;
    }
    .slider-group {
        width: 100%;
        gap: 10px;
    }
    .slider {
        flex: 1;
        width: auto;
        min-width: 0;
    }
    .slider-value {
        min-width: 42px;
        font-size: 15px;
    }
}

@media (max-width: 360px) {
    .slider { width: auto; }
    .slider-value { font-size: 14px; min-width: 36px; }
    .number-input { width: 90px; font-size: 16px; }
    .result-value { font-size: 34px; }
}
