:root {
  --ink: #202124;
  --muted: #68707a;
  --line: #dfe3e8;
  --paper: #f7f8fa;
  --panel: #ffffff;
  --nav: #24313f;
  --nav-soft: #334456;
  --green: #157f5b;
  --teal: #167582;
  --red: #b8473d;
  --gold: #a66b16;
  --blue: #3769a8;
  --shadow: 0 16px 38px rgba(32, 33, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  color: #f5f7f8;
  background: var(--nav);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #f0b95e;
  color: #1b2836;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.metric span,
.metric strong {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
}

.brand p {
  margin-top: 2px;
  color: #c7d0d8;
  font-size: 13px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #eaf0f4;
  background: transparent;
  text-align: left;
  padding: 0 14px;
}

.nav-tab:hover,
.nav-tab.active {
  background: var(--nav-soft);
  border-color: rgba(255, 255, 255, 0.12);
}

.status-panel {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.status-label,
.subtle,
.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.status-panel .status-label,
.status-panel span:last-child {
  color: #c7d0d8;
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}

.topbar h2 {
  font-size: 30px;
  line-height: 1.15;
}

.topbar-actions,
.panel-actions,
.idea-input-row,
.panel-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.primary-button,
.ghost-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
}

.primary-button {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.ghost-button {
  background: #fff;
  color: var(--ink);
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-chip.logged-in {
  border-color: #b7dece;
  background: #e9f5f1;
  color: var(--green);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 18px;
}

.metric strong {
  font-size: 32px;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
}

.course-now-panel {
  box-shadow: var(--shadow);
}

.course-now {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.course-now > div {
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.course-now strong {
  display: block;
  margin: 8px 0;
  font-size: 16px;
}

.course-now p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel h3 {
  font-size: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e9f5f1;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.task-list,
.upcoming-list,
.roadmap-list,
.journal-list,
.feature-list {
  display: grid;
  gap: 10px;
}

.task-item,
.upcoming-item,
.roadmap-item,
.journal-item,
.feature-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-item {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.task-main-row,
.task-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.task-main-row {
  justify-content: space-between;
}

.task-check {
  min-width: 0;
  color: var(--ink);
}

.task-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.task-title {
  font-weight: 700;
}

.task-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.score-badge {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef4fb;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.task-understanding {
  color: var(--muted);
}

.task-understanding textarea {
  min-height: 84px;
}

.ai-advice {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: #f7f8fa;
  border: 1px solid var(--line);
}

.ai-advice strong {
  font-size: 13px;
}

.ai-advice p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.task-actions {
  display: flex;
  justify-content: flex-end;
}

.ai-score-button {
  min-height: 42px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  padding: 0 14px;
  font-weight: 800;
}

.ai-score-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.upcoming-item,
.roadmap-item,
.journal-item,
.feature-item {
  padding: 12px;
}

.upcoming-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
}

.date-chip {
  color: var(--blue);
  font-weight: 800;
  font-size: 13px;
}

.note-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

textarea,
input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  resize: vertical;
}

.panel-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.roadmap-item.current {
  border-color: var(--green);
  background: #f3fbf7;
}

.roadmap-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
  font-weight: 800;
}

.roadmap-item p,
.journal-item p,
.feature-item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.week-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.week-card.active {
  border-color: var(--green);
  background: #f3fbf7;
}

.week-card-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.week-card-title span {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.week-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.journal-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.idea-input-row {
  align-items: stretch;
}

.idea-input-row input {
  min-height: 42px;
}

.feature-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.feature-item.done {
  opacity: 0.64;
}

.feature-item button {
  min-width: 72px;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.principles {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

.auth-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.auth-card strong {
  font-size: 18px;
}

.auth-session {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #f7f8fa;
  color: var(--muted);
}

.auth-session p {
  margin: 0;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.rule-card {
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.rule-card strong {
  display: block;
  margin-bottom: 8px;
}

.rule-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.rules-list {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.8;
}

.boundary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.boundary-step {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.boundary-step span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 999px;
  background: #e9f5f1;
  color: var(--green);
  font-weight: 800;
}

.boundary-step strong {
  display: block;
  margin-bottom: 8px;
}

.boundary-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 16px;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-tab {
    text-align: center;
  }

  .status-panel {
    display: none;
  }

  .metric-grid,
  .content-grid,
  .course-now,
  .note-layout,
  .rules-grid,
  .boundary-grid,
  .week-grid,
  .auth-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .topbar-actions,
  .auth-session,
  .panel-header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .upcoming-item {
    grid-template-columns: 1fr;
  }
}
