.module-workspace-page,
.module-workspace-page * {
  box-sizing: border-box;
}

.module-workspace-shell {
  display: grid;
  grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  width: 100%;
  min-width: 0;
}

.module-workspace-tree {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: calc(100vh - 116px);
  padding: 18px 12px 12px;
  border: 1px solid #dce4dd;
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.module-tree-heading {
  padding: 0 8px 14px;
}

.module-tree-heading h2 {
  margin: 0 0 7px;
  font-size: 17px;
  line-height: 1.4;
}

.module-tree-heading p {
  margin: 0;
  color: #768279;
  font-size: 12px;
  line-height: 1.5;
}

.module-workspace-tree button {
  margin: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #34493c;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.module-tree-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 11px 12px;
  font-size: 14px !important;
  font-weight: 650 !important;
  overflow-wrap: anywhere;
}

.module-workspace-tree .module-tree-all.is-selected {
  background: #edf3ed;
  color: #2d5d48;
}

.module-tree-all-arrow {
  flex: none;
  color: #7f9186;
}

.module-tree-scroll {
  min-height: 0;
  margin-top: 9px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #d1dbd3 transparent;
  overscroll-behavior: contain;
}

.module-tree-list,
.module-tree-children {
  margin: 0;
  padding: 0;
  list-style: none;
}

.module-tree-list > .module-tree-item + .module-tree-item {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eef2ee;
}

.module-tree-item {
  min-width: 0;
}

.module-tree-select {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 39px;
  padding: 9px 8px 9px calc(8px + var(--module-tree-depth, 0) * 13px);
  font-size: 13px !important;
  line-height: 1.5 !important;
}

.module-workspace-tree .module-tree-select:hover,
.module-workspace-tree .module-tree-select.is-selected {
  background: color-mix(in srgb, var(--module-item-color, #dbede5) 55%, white);
}

.module-workspace-tree .module-tree-select.is-selected {
  color: #21392d;
  box-shadow: inset 3px 0 0 var(--module-item-color, #dbede5);
}

.module-workspace-tree button:focus-visible {
  outline: 2px solid #49775f;
  outline-offset: -2px;
}

.module-tree-marker {
  display: flex;
  flex: 0 0 19px;
  align-items: center;
  justify-content: center;
  width: 19px;
  min-height: 19px;
}

.module-tree-direction-dot {
  width: 9px;
  height: 9px;
  border: 1px solid #9fb4a6;
  border-radius: 50%;
  background: var(--module-item-color, #dbede5);
}

.module-tree-outcome-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 22px;
  border: 1px solid #c7d2c9;
  border-radius: 4px;
  background: var(--module-item-color, #dbede5);
  color: #63796b;
  font-size: 12px;
}

.module-tree-cover {
  display: block;
  width: 19px;
  height: 25px;
  border-radius: 3px;
  object-fit: cover;
  background: #eef2ee;
}

.module-tree-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.module-tree-item.is-direction > .module-tree-select {
  font-weight: 600;
}

.module-tree-kind {
  flex: none;
  padding: 2px 4px;
  border-radius: 4px;
  background: #f2f5f2;
  color: #819085;
  font-size: 10px;
  line-height: 1.3;
}

.module-tree-empty {
  padding: 18px 10px;
  color: #768279;
  font-size: 13px;
}

.module-workspace-content {
  min-width: 0;
}

.module-workspace-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.module-workspace-heading h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.module-workspace-heading .workspace-actions,
.module-workspace-heading .module-workspace-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-workspace-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: start;
  gap: 20px;
  min-width: 0;
}

.module-workspace-panels > .card {
  min-width: 0;
  margin: 0;
  padding: 24px;
  border: 1px solid #dce4dd;
  border-radius: 18px;
  background: #fff;
}

.module-workspace-panels .card-top {
  gap: 10px;
}

.module-workspace-panels h2 {
  font-size: 20px;
}

.module-workspace-panels textarea,
.module-workspace-panels input,
.module-workspace-panels select {
  width: 100%;
  min-width: 0;
}

.module-workspace-panels .workspace-note-list {
  min-width: 0;
}

.module-workspace-panels .workspace-note-text {
  margin: 0;
  color: var(--text, #25352e);
  font-size: 13px;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.module-workspace-panels .workspace-note-text.note-markdown { white-space: normal; }

.module-workspace-panels > .workspace-notes,
.module-workspace-panels > .workspace-goals {
  max-height: max(400px, calc(100vh - 225px));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d1dbd3 transparent;
}

.workspace-note-actions,
.workspace-note-modes {
  display: flex;
  align-items: center;
  gap: 9px;
}

.workspace-note-modes { gap: 2px; }
.workspace-note-modes button {
  min-height: 28px;
  padding: 3px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #859087;
  font-size: 12px;
  font-weight: 400;
}
.workspace-note-modes button[aria-pressed="true"] { background: #edf2ee; color: #416451; }

.workspace-note-entry {
  min-width: 0;
  padding: 15px 16px;
  border-bottom: 1px solid #e2e8e2;
  border-radius: 6px;
  background: rgba(76, 112, 171, .07);
}
.workspace-note-entry:nth-child(4n + 2) { background: rgba(71, 125, 87, .07); }
.workspace-note-entry:nth-child(4n + 3) { background: rgba(128, 96, 168, .07); }
.workspace-note-entry:nth-child(4n) { background: rgba(169, 114, 54, .07); }
.workspace-note-time {
  display: block;
  margin-top: 10px;
  color: #929c94;
  font-size: 11px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.workspace-note-summary { display: flex; align-items: center; gap: 14px; min-width: 0; }
.workspace-note-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 1.6; }
.workspace-note-summary .workspace-note-time { flex: none; margin: 0; white-space: nowrap; }
[data-notes-display="collapsed"] .workspace-note-list { gap: 5px; }
[data-notes-display="collapsed"] .workspace-note-entry { padding: 11px 12px; }

.module-workspace-panels > .workspace-goals { padding: 20px 16px; }
.workspace-goals .card-top { margin-bottom: 18px; }
.workspace-goals h2 { font-size: 17px; white-space: nowrap; }
.workspace-goal-count { margin-left: 4px; color: #9ba49e; font-size: 11px; font-weight: 400; }
.workspace-goals .outcome-add-link { flex: none; padding: 2px 0; min-height: 25px; border: 0; background: transparent; font-size: 12px; }
.workspace-goals .purpose-cards { gap: 0; }
.workspace-goals .purpose-card + .purpose-card { margin-top: 12px; }
.workspace-goals .purpose-sentence { min-height: 0; padding: 0; color: #63726a; font-size: 12px; font-weight: 400; line-height: 1.8; }
.workspace-goals .empty { color: #9ba49e; font-size: 12px; }

@media (min-width: 1800px) {
  .module-workspace-shell {
    grid-template-columns: 310px minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  .module-workspace-shell {
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 18px;
  }

  .module-workspace-panels { grid-template-columns: minmax(0, 1fr) 190px; gap: 14px; }
  .module-workspace-panels > .card { padding: 20px 16px; }
}

@media (max-width: 980px) {
  .module-workspace-panels { grid-template-columns: minmax(0, 1fr); }
  .module-workspace-panels > .workspace-notes,
  .module-workspace-panels > .workspace-goals { max-height: none; }
}

@media (max-width: 760px) {
  .module-workspace-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .module-workspace-tree {
    position: static;
    max-height: 340px;
  }

  .module-workspace-heading {
    flex-wrap: wrap;
    margin-bottom: 16px;
  }

  .module-workspace-heading h1 {
    font-size: 24px;
  }

  .module-workspace-panels > .card {
    padding: 20px;
  }
  .workspace-note-summary { flex-wrap: wrap; gap: 5px; }
  .workspace-note-summary .workspace-note-time { width: 100%; }
  .workspace-note-actions { gap: 5px; }
}
