* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}
#app { max-width: 1200px; margin: 0 auto; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
header h1 { font-size: 24px; }
.header-actions { display: flex; gap: 10px; }
.header-actions button {
    padding: 8px 16px;
    border: 2px solid rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.15);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.header-actions button:hover {
    background: rgba(255,255,255,0.3);
    border-color: white;
}

.section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    color: #333;
}
.section-subtitle {
    font-size: 15px;
    font-weight: 600;
    margin: 16px 0 10px;
    color: #555;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.info-item label {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    min-width: 90px;
}
.info-item input { flex: 1; min-width: 0; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    background: #f8f9fa;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e9ecef;
}
.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
}
.data-table tr:hover { background: #f8f9ff; }
.data-table .subtotal-row {
    background: #f0f4ff !important;
    font-weight: 600;
}
.data-table .total-row {
    background: #667eea !important;
    color: white;
    font-weight: 700;
    font-size: 15px;
}
.data-table .total-row td { border: none; }

input[type="number"] {
    width: 100px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    text-align: right;
    transition: border-color 0.2s;
}
input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0;
}
.slider-container span:first-child { font-weight: 600; min-width: 50px; }
.slider-container input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    background: linear-gradient(to right, #667eea, #764ba2);
    border-radius: 4px;
    outline: none;
}
.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.slider-value {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
    min-width: 80px;
    text-align: center;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.dash-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #eef1ff 100%);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    border: 1px solid #e0e5ff;
}
.dash-card .label { font-size: 13px; color: #888; margin-bottom: 6px; }
.dash-card .value { font-size: 24px; font-weight: 700; color: #333; }
.dash-card .unit { font-size: 13px; color: #999; margin-left: 2px; }
.dash-card.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}
.dash-card.highlight .label { color: rgba(255,255,255,0.8); }
.dash-card.highlight .value { color: white; }
.dash-card.highlight .unit { color: rgba(255,255,255,0.7); }
.dash-card.warning {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #ffcc80;
}
.dash-card.warning .value { color: #e65100; }
.dash-card.negative .value { color: #d32f2f; }

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.chart-box {
    background: #fafbff;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e8ecff;
}
.chart-box h4 {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    text-align: center;
}

.profit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 16px;
}
.profit-table th, .profit-table td {
    padding: 8px 10px;
    text-align: center;
    border: 1px solid #e9ecef;
}
.profit-table th { background: #f8f9fa; font-weight: 600; }
.profit-table .positive { color: #2e7d32; font-weight: 600; }
.profit-table .negative { color: #d32f2f; font-weight: 600; }
.profit-table .breakeven { background: #fff8e1; }

/* 时段入座率网格 */
.period-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin: 12px 0;
}
.period-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.period-item .period-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}
.period-item .period-time {
    font-size: 11px;
    color: #999;
}
.period-item input {
    width: 70px;
}

/* 淡旺季 */
.season-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin: 12px 0;
}
.season-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-size: 13px;
}
.season-item .month-label { font-weight: 600; color: #555; margin-bottom: 4px; }
.season-item input { width: 60px; }
.season-item.peak { background: #fff3e0; border: 1px solid #ffcc80; }
.season-item.off { background: #e3f2fd; border: 1px solid #90caf9; }

/* 自定义项按钮 */
.add-row-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: #f0f4ff;
    border: 1px dashed #667eea;
    border-radius: 6px;
    color: #667eea;
    cursor: pointer;
    font-size: 13px;
    margin-top: 8px;
    transition: all 0.2s;
}
.add-row-btn:hover { background: #e0e8ff; }
.del-btn {
    background: none;
    border: none;
    color: #d32f2f;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
}
.del-btn:hover { background: #ffebee; border-radius: 4px; }

/* 模式切换 */
.mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.mode-btn {
    padding: 8px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.mode-btn.active {
    background: #667eea;
    color: white;
}
.mode-btn:hover:not(.active) { background: #f0f4ff; }

/* 提示文字 */
.hint { font-size: 12px; color: #999; margin-top: 4px; }
.formula-hint {
    background: #f8f9fa;
    border-left: 3px solid #667eea;
    padding: 10px 14px;
    margin: 12px 0;
    font-size: 13px;
    color: #555;
    border-radius: 0 6px 6px 0;
}

footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
}

/* ========== 移动端优化 ========== */
@media (max-width: 768px) {
    body { padding: 8px; }
    header { padding: 14px; flex-direction: column; text-align: center; }
    header h1 { font-size: 17px; }
    .header-actions { width: 100%; justify-content: center; }
    .header-actions button { padding: 6px 12px; font-size: 13px; }
    .section { padding: 14px; margin-bottom: 12px; border-radius: 10px; }
    .section-title { font-size: 16px; margin-bottom: 12px; }
    .section-subtitle { font-size: 14px; margin: 12px 0 8px; }
    .charts-grid { grid-template-columns: 1fr; gap: 12px; }
    .dashboard { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .dash-card { padding: 14px 10px; }
    .dash-card .value { font-size: 20px; }
    .dash-card .label { font-size: 12px; }
    .info-grid { grid-template-columns: 1fr; gap: 8px; }
    .info-item { flex-wrap: wrap; }
    .info-item label { min-width: 80px; font-size: 13px; }
    .period-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .season-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .season-item { padding: 8px 4px; }
    .season-item .month-label { font-size: 12px; }
    .season-item input { width: 50px; font-size: 12px; }
    input[type="number"] { width: 70px; padding: 5px 6px; font-size: 13px; }
    /* 表格移动端：横向滚动 */
    .data-table { font-size: 13px; display: block; overflow-x: auto; white-space: nowrap; }
    .data-table thead, .data-table tbody, .data-table tfoot { display: table; width: 100%; }
    .data-table th, .data-table td { padding: 6px 8px; }
    .profit-table { font-size: 11px; display: block; overflow-x: auto; }
    .profit-table thead, .profit-table tbody { display: table; width: 100%; }
    .profit-table th, .profit-table td { padding: 5px 6px; white-space: nowrap; }
    .formula-hint { font-size: 12px; padding: 8px 10px; }
    .hint { font-size: 11px; }
    .mode-toggle { flex-wrap: wrap; }
    .mode-btn { padding: 6px 14px; font-size: 13px; }
    .add-row-btn { font-size: 12px; padding: 5px 10px; }
    .slider-value { font-size: 22px; min-width: 60px; }
    footer { font-size: 11px; padding: 12px; }
}
@media (max-width: 480px) {
    body { padding: 6px; }
    header h1 { font-size: 15px; }
    .dashboard { grid-template-columns: 1fr 1fr; gap: 8px; }
    .dash-card { padding: 10px 8px; }
    .dash-card .value { font-size: 18px; }
    .info-grid { grid-template-columns: 1fr; }
    .period-grid { grid-template-columns: 1fr; }
    .season-grid { grid-template-columns: repeat(3, 1fr); }
    input[type="number"] { width: 60px; font-size: 12px; }
    .data-table th, .data-table td { padding: 5px 6px; font-size: 12px; }
    .period-grid { grid-template-columns: 1fr; }
    .season-grid { grid-template-columns: repeat(3, 1fr); }
}