/* Layout clarity pass · keep the bright, rounded learning direction while
   giving the growing toolbox a visible information hierarchy. */
:root {
  --layout-gutter: clamp(18px, 4vw, 64px);
  --layout-max: 1640px;
  --layout-divider: rgba(112, 137, 128, .18);
}

html, body { overflow-x: hidden; }

.main-panel > .view.active {
  width: 100%;
  max-width: var(--layout-max);
  margin-inline: auto;
}

.sidebar-section { margin: 0 0 13px; }
.sidebar-section + .sidebar-section {
  border-top: 1px solid rgba(177, 203, 195, .11);
  padding-top: 11px;
}
.sidebar-section-label {
  margin: 0 13px 6px;
  color: #6f817c;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}
.sidebar .nav-list { gap: 4px; }
.sidebar .nav-item { min-height: 43px; }
.sidebar > .sidebar-label { margin-top: 14px; }

/* Keep each home layer visually separate: today, routes, then exploration. */
#homeView .today-learning-card {
  margin: 18px var(--layout-gutter) 0;
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(24, 78, 69, .08);
}
#homeView .home-purpose {
  margin: 16px var(--layout-gutter) 0;
  border-radius: 26px;
}
#homeView .hero-grid {
  margin: 20px var(--layout-gutter) 0;
  border: 1px solid rgba(70, 99, 94, .15);
  border-radius: 26px;
  box-shadow: 0 18px 42px rgba(11, 38, 43, .08);
}
#homeView .dashboard-grid {
  padding-inline: var(--layout-gutter);
}
#homeView .home-section-intro {
  margin-inline: var(--layout-gutter);
}
#homeView .home-insight-grid,
#homeView .knowledge-map {
  margin-inline: var(--layout-gutter);
}

/* Pages get one shared reading rhythm instead of each module starting at a
   different width. */
.page-head,
.simple-view > .page-head { padding-inline: var(--layout-gutter); }
.page-head { margin-top: 26px; margin-bottom: 18px; }
.search-layout,
.field-layout,
.learning-layout,
.toolkit-layout,
.review-layout,
.dcs-layout,
.handbook-layout { margin-inline: var(--layout-gutter); }

.mobile-more-sheet { border-radius: 26px 26px 0 0; }
.mobile-more-group + .mobile-more-group { border-top: 1px solid var(--layout-divider); }

@media (max-width: 1100px) {
  #homeView .hero-grid { margin-inline: 20px; }
  #homeView .home-purpose,
  #homeView .today-learning-card { margin-inline: 20px; }
  #homeView .home-section-intro,
  #homeView .home-insight-grid,
  #homeView .knowledge-map,
  #homeView .dashboard-grid { margin-inline: 20px; }
  .page-head,
  .simple-view > .page-head { padding-inline: 20px; }
  .search-layout,
  .field-layout,
  .learning-layout,
  .toolkit-layout,
  .review-layout,
  .dcs-layout,
  .handbook-layout { margin-inline: 20px; }
}

@media (max-width: 700px) {
  .topbar { min-height: 58px; height: auto; padding: 8px 14px; gap: 8px; }
  .plant-status { min-width: 0; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
  .plant-status i { margin-inline: 4px; }
  .top-actions { gap: 5px; }
  .top-actions .install-app { display: none; }
  .profile { margin-left: 0; padding: 3px; }
  .profile > span, .profile > i { display: none; }
  .avatar { width: 34px; height: 34px; }

  #homeView .today-learning-card,
  #homeView .home-purpose,
  #homeView .hero-grid { margin-inline: 12px; }
  #homeView .home-section-intro,
  #homeView .home-insight-grid,
  #homeView .knowledge-map,
  #homeView .dashboard-grid { margin-inline: 12px; }
  #homeView .dashboard-grid { padding-inline: 0; }

  .page-head,
  .simple-view > .page-head { padding-inline: 16px; margin-top: 18px; }
  .page-head h1 { font-size: clamp(27px, 8vw, 38px); line-height: 1.12; }
  .search-layout,
  .field-layout,
  .learning-layout,
  .toolkit-layout,
  .review-layout,
  .dcs-layout,
  .handbook-layout { margin-inline: 12px; }

  .mobile-more-dialog[open] .mobile-more-sheet { padding: 18px 14px calc(22px + env(safe-area-inset-bottom)); }
  .mobile-more-grid { gap: 8px; }
  .mobile-more-grid button { min-height: 64px; border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  #homeView .hero-grid,
  #homeView .today-learning-card,
  #homeView .home-purpose { scroll-behavior: auto; transition: none; }
}

/* AI 搜索先给一句结论，完整证据按需展开（2026-08-01） */
.diagnosis-direct-summary {
  border-color: #a9def1;
  background: linear-gradient(135deg, #f1fbff 0%, #ffffff 72%);
  box-shadow: 0 12px 28px rgba(23, 117, 151, .08);
}

.diagnosis-direct-summary h3 {
  margin: 9px 0 8px;
  color: #183b44;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.2;
}

.direct-conclusion-copy {
  max-width: 920px;
  margin: 0;
  color: #294f59 !important;
  font-size: clamp(17px, 1.8vw, 24px) !important;
  font-weight: 800;
  line-height: 1.62 !important;
}

.direct-conclusion-note {
  display: block;
  margin-top: 10px;
  color: #71888e;
  font-size: 11px;
  line-height: 1.5;
}

.diagnosis-details {
  overflow: hidden;
  border: 1px solid #dbe9eb;
  border-radius: 18px;
  background: #fff;
}

.diagnosis-details > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 18px;
  color: #17516b;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.diagnosis-details > summary::-webkit-details-marker { display: none; }
.diagnosis-details > summary b {
  margin-left: auto;
  color: #71848a;
  font-size: 10px;
  font-weight: 700;
}
.diagnosis-details > summary i {
  color: #1686b9;
  font-size: 16px;
  font-style: normal;
  transition: transform .2s ease;
}
.diagnosis-details[open] > summary {
  border-bottom: 1px solid #e1ecee;
  background: #f5fbfd;
}
.diagnosis-details[open] > summary i { transform: rotate(180deg); }
.diagnosis-details-body { padding: 14px; }

.diagnosis-flow-full-summary {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-left: 4px solid #28aee8;
  border-radius: 12px;
  background: #f3f9fc;
}
.diagnosis-flow-full-summary small {
  color: #1780aa;
  font-size: 11px;
  font-weight: 900;
}
.diagnosis-flow-full-summary p {
  margin: 7px 0 0;
  color: #536d74;
  font-size: 12px;
  line-height: 1.75;
}

/* 工作台首页：移动端入口重排（2026-08-01）
   这一层故意放在所有旧主题之后，避免历史样式把卡片撑出视口。 */
#homeView,
#homeView .home-purpose,
#homeView .home-purpose-grid,
#homeView .purpose-card,
#homeView .purpose-card-copy,
#homeView .purpose-actions {
  min-width: 0;
  max-width: 100%;
}

#homeView { overflow-x: clip; }

/* AI 搜索是工作台的第一入口：桌面和手机都保持在首屏上方。 */
#homeView .home-ai-first {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: 18px var(--layout-gutter) 0;
  padding: 18px 20px;
  border: 2px solid #bfe8ff;
  border-bottom-width: 6px;
  border-radius: 24px;
  background: linear-gradient(105deg, #f2fbff 0%, #fff 70%);
  box-shadow: 0 7px 0 rgba(184, 218, 226, .58), 0 16px 34px rgba(49, 133, 160, .08);
}

.home-ai-first-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #1cb0f6;
  color: #fff;
  font-size: 25px;
  box-shadow: 0 4px 0 #0b8dc9;
}

.home-ai-first-copy > span {
  color: #1483ba;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.5px;
}

.home-ai-first-copy h2 {
  margin: 4px 0 3px;
  color: #193c4a;
  font-size: clamp(20px, 2.1vw, 28px);
  line-height: 1.2;
}

.home-ai-first-copy p {
  margin: 0;
  color: #607b85;
  font-size: 12px;
  line-height: 1.6;
}

.home-ai-first-action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  min-width: 164px;
  padding: 0 16px;
  border: 0;
  border-bottom: 4px solid #0b8dc9;
  border-radius: 14px;
  background: #1cb0f6;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.home-ai-first-action i { font-size: 18px; font-style: normal; }
.home-ai-first-action:active { transform: translateY(2px); border-bottom-width: 2px; }

@media (max-width: 700px) {
  #homeView .home-ai-first {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    margin: 12px !important;
    padding: 14px !important;
    border-radius: 20px !important;
  }

  .home-ai-first-mark { width: 42px; height: 42px; border-radius: 13px; font-size: 21px; }
  .home-ai-first-copy > span { font-size: 8px; letter-spacing: 1.1px; }
  .home-ai-first-copy h2 { font-size: 20px; }
  .home-ai-first-copy p { font-size: 12px; line-height: 1.55; }
  .home-ai-first-action {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    min-height: 48px;
  }

  #homeView .home-purpose {
    width: auto !important;
    margin: 14px 12px 0 !important;
    padding: 16px !important;
    box-sizing: border-box;
    overflow: hidden;
  }

  #homeView .home-purpose-head h2 {
    font-size: 24px !important;
    line-height: 1.2 !important;
  }

  #homeView .home-purpose-head > p {
    font-size: 12px !important;
    line-height: 1.6 !important;
  }

  #homeView .home-purpose-grid {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  #homeView .purpose-card {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
    padding: 16px !important;
    border-radius: 20px !important;
    overflow: hidden;
  }

  #homeView .purpose-card-head {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 12px !important;
  }

  #homeView .purpose-card-copy h3 {
    font-size: 24px !important;
    line-height: 1.2 !important;
  }

  #homeView .purpose-card-copy p {
    max-width: none !important;
    font-size: 13px !important;
    line-height: 1.65 !important;
    overflow-wrap: anywhere;
  }

  #homeView .purpose-tags {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin: 12px 0 !important;
  }

  #homeView .purpose-actions {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-top: 0 !important;
  }

  #homeView .purpose-actions button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    box-sizing: border-box;
    white-space: normal;
    line-height: 1.35;
  }

  #homeView .purpose-actions .purpose-primary {
    grid-column: 1 / -1;
  }

  #homeView .today-learning-card,
  #homeView .hero-grid,
  #homeView .dashboard-grid {
    width: auto !important;
    max-width: calc(100% - 24px) !important;
    box-sizing: border-box;
  }

  .main-panel {
    min-width: 0 !important;
    overflow-x: clip !important;
  }
}

@media (max-width: 380px) {
  #homeView .purpose-actions {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #homeView .purpose-actions .purpose-primary {
    grid-column: auto;
  }
}

@media (max-width: 700px) {
  .diagnosis-direct-summary { padding: 16px; border-radius: 18px; }
  .diagnosis-direct-summary h3 { font-size: 22px; }
  .direct-conclusion-copy { font-size: 18px !important; line-height: 1.7 !important; }
  .diagnosis-details > summary { min-height: 52px; padding: 0 14px; font-size: 13px; }
  .diagnosis-details > summary b { max-width: 126px; line-height: 1.35; text-align: right; }
  .diagnosis-details-body { padding: 10px; }
}

/* 首页层级整理：三张目标卡始终成组，不再出现“跨整行 + 右侧空白”。 */
#homeView .home-ai-first,
#homeView .today-learning-card,
#homeView .home-purpose {
  width: min(calc(100% - 40px), 1320px);
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
}

#homeView .home-purpose {
  padding: 28px 30px 30px;
  background: #fff;
  border-color: #dfe9e5;
  box-shadow: 0 8px 0 rgba(211, 221, 218, .66), 0 20px 44px rgba(37, 78, 70, .08);
}

#homeView .home-purpose-head {
  align-items: center;
  margin-bottom: 20px;
}

#homeView .home-purpose-head h2 {
  color: #172f35;
  font-size: clamp(28px, 2.6vw, 38px);
}

#homeView .home-purpose-head > p {
  color: #607873;
  font-size: 13px;
}

#homeView .home-purpose-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px;
}

#homeView .purpose-card,
#homeView .purpose-field {
  grid-column: auto !important;
  min-height: 286px;
  padding: 22px;
  border: 2px solid #dfe9e5;
  border-radius: 24px;
  box-shadow: 0 5px 0 rgba(215, 225, 221, .72);
}

#homeView .purpose-learn {
  border-color: #bfe99b;
  background: linear-gradient(145deg, #f8fff0, #e4ffca);
}

#homeView .purpose-field {
  color: #183b47;
  border-color: #b9e4f6;
  background: linear-gradient(145deg, #f3fbff, #dff4ff);
}

#homeView .purpose-review {
  border-color: #e0c9f5;
  background: linear-gradient(145deg, #fff8ff, #f1e6ff);
}

#homeView .purpose-card-copy h3,
#homeView .purpose-field .purpose-card-copy h3 {
  color: #17343b;
}

#homeView .purpose-card-copy p,
#homeView .purpose-field .purpose-card-copy p {
  color: #5d7472;
}

#homeView .purpose-field .purpose-card-copy > span { color: #1686b8; }
#homeView .purpose-field .purpose-symbol,
#homeView .purpose-review .purpose-symbol,
#homeView .purpose-learn .purpose-symbol {
  border-color: rgba(46, 107, 105, .14);
  background: rgba(255, 255, 255, .72);
  color: #22616b;
}

#homeView .purpose-field .purpose-tags span,
#homeView .purpose-review .purpose-tags span,
#homeView .purpose-learn .purpose-tags span {
  border-color: rgba(75, 126, 119, .16);
  background: rgba(255, 255, 255, .64);
  color: #57736e;
}

#homeView .purpose-field .purpose-primary {
  background: #1cb0f6;
  color: #fff;
  box-shadow: 0 5px 0 #0b8dc9;
}

#homeView .purpose-review .purpose-primary {
  background: #a66bea;
  color: #fff;
  box-shadow: 0 5px 0 #8050bb;
}

@media (min-width: 701px) and (max-width: 759px) {
  #homeView .home-purpose-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 700px) {
  #homeView .home-ai-first,
  #homeView .today-learning-card,
  #homeView .home-purpose {
    width: auto !important;
    margin-left: 12px !important;
    margin-right: 12px !important;
  }

  #homeView .home-purpose { padding: 18px 16px 20px !important; }
  #homeView .home-purpose-grid { grid-template-columns: minmax(0, 1fr) !important; }
  #homeView .purpose-card,
  #homeView .purpose-field {
    min-height: 0;
    box-shadow: 0 4px 0 rgba(215, 225, 221, .72);
  }
}
