@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@600;700&display=swap');

:root {
    --primary: #0f172a;
    --accent: #2563eb;
    --success: #10b981;
    --border: #e2e8f0;
    --bg-light: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: #f1f5f9;
    color: var(--text-main);
    overflow: hidden;
    /* 强制一屏显示 */
    height: 100vh;
}

/* 紧凑型导航栏 */
.navbar {
    background: var(--primary);
    color: white;
    padding: 0 1.5rem;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 15px;
}

.nav-link {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.nav-link.active {
    color: white;
    border-bottom: 2px solid var(--accent);
}

/* 主体容器 - 撑满剩余空间 */
.dashboard-main {
    height: calc(100vh - 50px);
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 10px;
}

/* 顶部配置行 */
.config-bar {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    gap: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    align-items: center;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.config-item select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
}

/* 核心布局网格 */
.core-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 280px 1fr;
    gap: 10px;
    min-height: 0;
    /* 允许子元素滚动或缩放 */
}

.panel {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    background: var(--bg-light);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.panel-body {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

/* 表单紧凑样式 */
.form-group {
    margin-bottom: 8px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 3px;
    font-weight: 600;
}

.input-with-unit {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    background: white;
}

.input-with-unit input {
    flex: 1;
    border: none;
    padding: 5px 8px;
    font-size: 0.85rem;
    outline: none;
    width: 0;
    /* fix flex width */
}

.input-with-unit span,
.input-with-unit select {
    background: var(--bg-light);
    border: none;
    border-left: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0 5px;
    display: flex;
    align-items: center;
}

.mode-box {
    background: #fefce8;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #fef08a;
    margin-bottom: 8px;
}

.mode-box label {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #854d0e;
}

/* 执行按钮 */
.calc-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 5px;
}

.calc-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* 右侧大面板：结果与图表并排 */
.visual-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.results-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.res-card {
    background: #f0f9ff;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #bae6fd;
}

.res-card .label {
    font-size: 0.7rem;
    color: #0369a1;
    font-weight: 600;
    margin-bottom: 2px;
}

.res-card .val {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0c4a6e;
    font-family: 'Outfit', sans-serif;
}

.chart-area {
    flex: 1;
    position: relative;
    min-height: 0;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1200px) {
    .core-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr;
        overflow-y: auto;
    }

    body {
        overflow: auto;
        height: auto;
    }
}