.brain-sheet {
  position: fixed;
  z-index: 46;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  transform: translate3d(0, 8px, 0);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.28s;
}

.brain-sheet.show {
  pointer-events: auto;
  visibility: visible;
  transform: translate3d(0, 0, 0);
  opacity: 1;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s;
}

.brain-sheet-head {
  /* Generic sheet headers use negative side margins; this page is full width. */
  margin: 0;
  width: 100%;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto minmax(72px, 1fr);
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-top, env(safe-area-inset-top, 0px)) + 6px) 12px 8px;
  background: #f2f4f7;
  border-bottom: 1px solid #ececec;
}

.brain-sheet-head-spacer {
  display: block;
}

.brain-sheet-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.brain-sheet-head button {
  justify-self: start;
  border: 0;
  background: transparent;
  color: #198cff;
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
  padding: 6px 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.brain-sheet-head button span {
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
}

.brain-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.brain-sheet-footer {
  flex: 0 0 auto;
  padding: 8px 16px calc(var(--safe-bottom, env(safe-area-inset-bottom, 0px)) + 12px);
  border-top: 1px solid #ececec;
  background: #fff;
}

.brain-sheet-footer button {
  width: 100%;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: #fafbfc;
  padding: 10px 12px;
  font-weight: 650;
  cursor: pointer;
}

.brain-section h3 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a8f96;
}

.brain-domain h4,
.brain-day h4 {
  margin: 12px 0 6px;
  font-size: 12px;
  color: #52525b;
}

.brain-fact,
.brain-journal,
.brain-intention-field {
  padding: 10px 0;
  border-bottom: 1px solid #f0f1f3;
}

.brain-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.brain-item-head strong {
  display: block;
  font-size: 13px;
}

.brain-item-value {
  display: block;
  margin-top: 2px;
  color: #171717;
  font-size: 14px;
  line-height: 1.35;
}

.brain-item-date {
  display: block;
  margin-top: 4px;
  color: #8a8f96;
  font-size: 11px;
}

.brain-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.brain-text-btn {
  border: 0;
  background: transparent;
  color: #198cff;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  padding: 2px 0;
}

.brain-history {
  margin: 8px 0 0;
  padding: 0 0 0 14px;
  color: #52525b;
  font-size: 12px;
}

.brain-history li {
  margin: 4px 0;
}

.brain-empty {
  margin: 0;
  color: #8a8f96;
  font-size: 14px;
  line-height: 1.45;
}

.brain-intention-card {
  border: 1px solid #e8eaed;
  border-radius: 14px;
  padding: 10px 12px;
  background: #fafbfc;
}

.brain-intention-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.brain-status {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #edf2ef;
  font-size: 11px;
  font-weight: 650;
}

.brain-load-more {
  width: 100%;
  margin-top: 10px;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  font-weight: 650;
  cursor: pointer;
}

.brain-confirm {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  padding: 14px 16px calc(var(--safe-bottom, env(safe-area-inset-bottom, 0px)) + 14px);
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid #ececec;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
}

.brain-confirm p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.4;
}

.brain-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.brain-confirm-actions button {
  border: 0;
  background: transparent;
  color: #198cff;
  font-weight: 700;
  cursor: pointer;
}

.brain-confirm-actions .is-danger {
  color: #e5484d;
}

html.brain-sheet-open .pane-chat .composer-wrap,
html.brain-sheet-open .home-pane-dock {
  pointer-events: none;
}

html.is-desktop-board .brain-sheet {
  inset: auto;
  left: 50%;
  top: 50%;
  width: min(440px, 92vw);
  height: min(720px, calc(100dvh - 48px));
  max-height: none;
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, -50%) scale(0.98);
}

html.is-desktop-board .brain-sheet.show {
  transform: translate(-50%, -50%) scale(1);
}

.composer-side-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
