/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #2D5F2D; --green-light: #4A7C59; --green-bg: #E8F0E8;
  --brown: #8B6914; --brown-light: #B8960A; --brown-bg: #FDF6E3;
  --cream: #FAF8F2; --sage: #A8C5A0;
  --red: #C0392B; --red-bg: #FDEDEC;
  --orange: #E67E22; --orange-bg: #FEF5E7;
  --blue: #2980B9; --blue-bg: #EBF5FB;
  --gray: #7F8C8D; --gray-light: #ECF0F1; --gray-dark: #2C3E50;
  --white: #FFFFFF; --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 10px; --radius-sm: 6px;
  --font: "PingFang SC","Microsoft YaHei","Hiragino Sans GB","Noto Sans CJK SC",sans-serif;
}
html { font-size: 15px; }
body { font-family: var(--font); background: var(--cream); color: var(--gray-dark); line-height: 1.6; min-height: 100vh; }
a { color: var(--green); text-decoration: none; }
h1,h2,h3 { font-weight: 600; }
input,textarea,select,button { font-family: var(--font); font-size: 0.95rem; }

/* === Screens === */
.screen { display: none; }
.screen.active { display: block; }

/* === Login === */
.login-container { max-width: 360px; margin: 15vh auto; text-align: center; padding: 2rem; }
.login-logo { font-size: 3.5rem; margin-bottom: 0.5rem; }
.login-container h1 { font-size: 1.5rem; color: var(--green); margin-bottom: 0.3rem; }
.login-subtitle { color: var(--gray); margin-bottom: 2rem; font-size: 0.9rem; }
#login-form { display: flex; flex-direction: column; gap: 0.8rem; }
#login-password { padding: 0.8rem 1rem; border: 2px solid var(--gray-light); border-radius: var(--radius-sm); text-align: center; font-size: 1rem; outline: none; transition: border-color 0.2s; }
#login-password:focus { border-color: var(--green); }
.error-text { color: var(--red); font-size: 0.85rem; min-height: 1.2em; }

/* === Buttons === */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.55rem 1.2rem; border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; transition: all 0.2s; }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-light); }
.btn-secondary { background: var(--gray-light); color: var(--gray-dark); }
.btn-secondary:hover { background: #dde4e6; }
.btn-danger { background: var(--red); color: white; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn-large { padding: 0.8rem 2rem; font-size: 1.05rem; }

/* === Start Screen === */
.start-container { max-width: 680px; margin: 6vh auto; padding: 2rem; }
.start-hero { text-align: center; margin-bottom: 2rem; }
.start-icon { font-size: 4rem; margin-bottom: 0.5rem; }
.start-hero h1 { font-size: 1.8rem; color: var(--green); }
.start-hero p { color: var(--gray); }
.start-desc { margin-top: 1rem; font-size: 0.9rem; line-height: 1.8; }
.start-phases { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
.phase-card { background: white; border-radius: var(--radius); padding: 1rem 1.2rem; border-left: 4px solid; box-shadow: var(--shadow); }
.phase-card strong { display: block; margin-bottom: 0.2rem; }
.phase-card p { font-size: 0.85rem; color: var(--gray); margin: 0; }
.phase-weeks { font-size: 0.75rem; color: var(--gray); background: var(--gray-light); padding: 0.1rem 0.5rem; border-radius: 10px; }
.start-action { text-align: center; }
.start-action label { display: block; color: var(--gray); margin-bottom: 0.5rem; }
.start-action input[type="date"] { padding: 0.5rem 1rem; border: 2px solid var(--gray-light); border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 1rem; }
.start-action .btn { display: block; width: 100%; margin-top: 0.5rem; }

/* === Top Nav === */
.top-nav { display: flex; align-items: center; gap: 1rem; padding: 0.6rem 1.5rem; background: white; border-bottom: 1px solid var(--gray-light); position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.nav-brand { font-weight: 700; font-size: 1.1rem; color: var(--green); white-space: nowrap; }
.nav-tabs { display: flex; gap: 0.3rem; flex: 1; overflow-x: auto; }
.nav-tab { background: none; border: none; padding: 0.5rem 0.8rem; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.9rem; color: var(--gray); white-space: nowrap; transition: all 0.2s; }
.nav-tab:hover { background: var(--gray-light); }
.nav-tab.active { background: var(--green-bg); color: var(--green); font-weight: 600; }
.nav-info { display: flex; gap: 0.5rem; white-space: nowrap; }
.week-badge { background: var(--green); color: white; padding: 0.2rem 0.7rem; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
.phase-badge { background: var(--brown-bg); color: var(--brown); padding: 0.2rem 0.7rem; border-radius: 12px; font-size: 0.8rem; }

/* === Main Content === */
.main-content { max-width: 900px; margin: 0 auto; padding: 1.5rem; }
.view { display: none; }
.view.active { display: block; }
.view-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }

/* === Stats Grid === */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: white; border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); text-align: center; }
.stat-label { font-size: 0.8rem; color: var(--gray); margin-bottom: 0.3rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--green); }
.progress-bar { height: 6px; background: var(--gray-light); border-radius: 3px; margin-top: 0.5rem; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 0.5s; }

/* === Section Card === */
.section-card { background: white; border-radius: var(--radius); padding: 1.2rem 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.section-card h3 { margin-bottom: 0.8rem; font-size: 1rem; }

/* === Phase Progress === */
.phase-progress-list { display: flex; flex-direction: column; gap: 0.8rem; }
.phase-progress-item { display: flex; align-items: center; gap: 1rem; }
.phase-progress-item .phase-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.phase-progress-item .phase-info { flex: 1; }
.phase-progress-item .phase-name { font-weight: 600; font-size: 0.9rem; }
.phase-progress-item .phase-bar { height: 8px; background: var(--gray-light); border-radius: 4px; margin-top: 0.3rem; overflow: hidden; }
.phase-progress-item .phase-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.phase-progress-item .phase-pct { font-size: 0.85rem; font-weight: 600; color: var(--gray); min-width: 3rem; text-align: right; }

/* === Checkpoint === */
.checkpoint-alert { background: var(--orange-bg); border: 2px solid var(--orange); border-radius: var(--radius); padding: 1.2rem 1.5rem; margin-bottom: 1.5rem; }
.checkpoint-alert h3 { color: var(--orange); margin-bottom: 0.5rem; }
.checkpoint-condition { padding: 0.3rem 0; display: flex; align-items: center; gap: 0.5rem; }
.checkpoint-condition::before { content: '☐'; }

/* === Day Selector === */
.day-selector { display: flex; gap: 0.3rem; }
.day-btn { width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 2px solid var(--gray-light); background: white; cursor: pointer; font-weight: 600; transition: all 0.2s; }
.day-btn:hover { border-color: var(--green); }
.day-btn.active { background: var(--green); color: white; border-color: var(--green); }

/* === Task List === */
.task-list { display: flex; flex-direction: column; gap: 0.5rem; }
.task-item { background: white; border-radius: var(--radius-sm); padding: 0.8rem 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.06); display: flex; align-items: flex-start; gap: 0.8rem; border-left: 4px solid var(--gray-light); transition: all 0.2s; }
.task-item:hover { box-shadow: var(--shadow); }
.task-item.priority-critical { border-left-color: var(--red); }
.task-item.priority-high { border-left-color: var(--orange); }
.task-item.priority-normal { border-left-color: var(--green); }
.task-item.status-completed { opacity: 0.6; background: var(--green-bg); }
.task-item.status-deferred { opacity: 0.7; background: var(--orange-bg); }
.task-item.status-skipped { opacity: 0.5; text-decoration: line-through; }
.task-checkbox { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--gray); cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; margin-top: 0.1rem; transition: all 0.2s; }
.task-checkbox:hover { border-color: var(--green); }
.task-checkbox.checked { background: var(--green); border-color: var(--green); color: white; }
.task-checkbox.checked::after { content: '✓'; font-size: 0.75rem; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 0.95rem; }
.task-desc { font-size: 0.83rem; color: var(--gray); margin-top: 0.2rem; }
.task-meta { display: flex; gap: 0.5rem; margin-top: 0.4rem; flex-wrap: wrap; }
.task-tag { font-size: 0.7rem; padding: 0.1rem 0.5rem; border-radius: 8px; background: var(--gray-light); color: var(--gray); }
.task-tag.cat-bridge_income { background: #E8DAEF; color: #6C3483; }
.task-tag.cat-boarding { background: #D5F5E3; color: #1E8449; }
.task-tag.cat-training { background: #D6EAF8; color: #2471A3; }
.task-tag.cat-research { background: #FCF3CF; color: #B7950B; }
.task-tag.cat-operations { background: #FADBD8; color: #C0392B; }
.task-tag.cat-mindset { background: #F5EEF8; color: #8E44AD; }
.task-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.task-action-btn { background: none; border: 1px solid var(--gray-light); border-radius: var(--radius-sm); padding: 0.2rem 0.5rem; font-size: 0.75rem; cursor: pointer; transition: all 0.2s; }
.task-action-btn:hover { background: var(--gray-light); }

/* === Filter Bar === */
.filter-bar { display: flex; gap: 0.3rem; margin-bottom: 1rem; }
.filter-btn { background: var(--gray-light); border: none; padding: 0.4rem 1rem; border-radius: 20px; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.filter-btn:hover { background: #dde4e6; }
.filter-btn.active { background: var(--green); color: white; }

/* === Report Form === */
.report-form { background: white; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.form-section { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--gray-light); }
.form-section:last-of-type { border-bottom: none; margin-bottom: 0.5rem; }
.form-section h3 { margin-bottom: 1rem; font-size: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--gray-dark); }
.form-group input, .form-group textarea, .form-group select {
  padding: 0.6rem 0.8rem; border: 1.5px solid var(--gray-light); border-radius: var(--radius-sm);
  outline: none; transition: border-color 0.2s; background: white;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--green); }
.form-group textarea { resize: vertical; }
.form-actions { display: flex; gap: 0.8rem; margin-top: 1rem; flex-wrap: wrap; }
.range-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--gray); }
input[type="range"] { width: 100%; accent-color: var(--green); }
.help-text { font-size: 0.85rem; color: var(--gray); margin-bottom: 1rem; }

/* === Week Navigator === */
.week-navigator { display: flex; align-items: center; gap: 0.5rem; }
#current-week-display { font-weight: 600; min-width: 5rem; text-align: center; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }

/* === Adjustment Items === */
.adjust-item { background: var(--cream); border-radius: var(--radius-sm); padding: 0.8rem 1rem; margin-bottom: 0.5rem; border-left: 3px solid var(--blue); }
.adjust-item .adjust-reason { font-size: 0.8rem; color: var(--gray); margin-bottom: 0.3rem; }
.adjust-item .adjust-title { font-weight: 600; }
.adjust-item .adjust-desc { font-size: 0.85rem; color: var(--gray-dark); margin-top: 0.2rem; }

/* === History === */
.history-tabs { display: flex; gap: 0.3rem; margin-bottom: 1rem; }
.report-history-item { background: white; border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 0.8rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.report-history-item h4 { margin-bottom: 0.5rem; color: var(--green); }
.report-history-item .meta { font-size: 0.85rem; color: var(--gray); }
.finance-chart { padding: 1rem; background: white; border-radius: var(--radius); }

/* === Utilities === */
.hidden { display: none !important; }
.toast { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%); background: var(--gray-dark); color: white; padding: 0.7rem 1.5rem; border-radius: var(--radius); font-size: 0.9rem; z-index: 1000; animation: fadeInUp 0.3s; }
@keyframes fadeInUp { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* === Responsive === */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .start-phases { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .top-nav { flex-wrap: wrap; padding: 0.5rem; }
  .nav-tabs { order: 3; width: 100%; }
  .nav-tab { font-size: 0.8rem; padding: 0.4rem 0.6rem; }
  .main-content { padding: 1rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  html { font-size: 14px; }
}
