/* SAGE Stage B — additive hamburger menu only. */
.sage-menu-hidden-clear {
	display: none !important;
}

#sage-chat-menu-button {
	width: 58px;
	height: 58px;
	flex: 0 0 58px;
	border: 0;
	border-radius: 20px;
	background: #e7f4f3;
	color: #008f8c;
	font-size: 26px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	-webkit-tap-highlight-color: transparent;
}

#sage-chat-menu-button:hover {
	background: #dff0ef;
}

#sage-chat-menu-button:focus-visible,
#sage-chat-menu-button[aria-expanded="true"] {
	outline: none;
	box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(0, 153, 153, 0.28);
}

#sage-chat-menu {
	position: fixed;
	z-index: 2147482500;
	min-width: 230px;
	max-width: min(320px, calc(100vw - 20px));
	background: #fff;
	border: 1px solid #d7e1df;
	border-radius: 16px;
	padding: 8px;
	box-shadow: 0 18px 46px rgba(0, 0, 0, 0.20);
	display: none;
}

#sage-chat-menu.open {
	display: grid;
	gap: 6px;
}

#sage-chat-menu button,
#sage-chat-menu a {
	box-sizing: border-box;
	width: 100%;
	border: 0;
	background: #f4f8f7;
	color: #202525;
	border-radius: 11px;
	padding: 12px 14px;
	text-align: left;
	font: inherit;
	font-weight: 700;
	line-height: 1.25;
	text-decoration: none;
	cursor: pointer;
}

#sage-chat-menu button:hover,
#sage-chat-menu a:hover,
#sage-chat-menu button:focus-visible,
#sage-chat-menu a:focus-visible {
	background: #eaf4f3;
	outline: 2px solid rgba(0, 153, 153, 0.30);
	outline-offset: 1px;
}

#sage-chat-menu .danger {
	color: #a62727;
}

@media (max-width: 600px) {
	#sage-chat-menu-button {
		width: 54px;
		height: 54px;
		flex-basis: 54px;
		border-radius: 18px;
	}
}

/* Stage B.1 — accessible SAGE confirmation modal. */
.sage-confirm-overlay {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(19, 31, 31, 0.48);
	backdrop-filter: blur(2px);
}

.sage-confirm-overlay.open {
	display: flex;
}

.sage-confirm-dialog {
	box-sizing: border-box;
	width: min(430px, 100%);
	background: #fff;
	border: 1px solid #d7e1df;
	border-radius: 22px;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
	padding: 26px;
	text-align: left;
}

.sage-confirm-icon {
	width: 48px;
	height: 48px;
	display: grid;
	place-items: center;
	border-radius: 15px;
	background: #eef7f6;
	font-size: 24px;
	margin-bottom: 14px;
}

.sage-confirm-dialog h2 {
	margin: 0 0 8px;
	font-size: clamp(22px, 4vw, 28px);
	line-height: 1.15;
	color: #202525;
}

.sage-confirm-dialog p {
	margin: 0;
	color: #687372;
	font-size: 16px;
	line-height: 1.5;
}

.sage-confirm-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 24px;
}

.sage-confirm-actions button {
	border: 1px solid #d7e1df;
	border-radius: 12px;
	padding: 11px 16px;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	background: #fff;
	color: #26302f;
}

.sage-confirm-actions .sage-confirm-clear {
	border-color: #a92c2c;
	background: #a92c2c;
	color: #fff;
}

.sage-confirm-actions button:hover,
.sage-confirm-actions button:focus-visible {
	outline: 3px solid rgba(0, 153, 153, 0.22);
	outline-offset: 2px;
}

@media (max-width: 520px) {
	.sage-confirm-dialog {
		padding: 22px;
		border-radius: 18px;
	}
	.sage-confirm-actions {
		flex-direction: column-reverse;
	}
	.sage-confirm-actions button {
		width: 100%;
	}
}

/* Stage C: response recovery. Intentionally scoped to failed-response cards only. */
.sage-response-error {
	max-width: 760px;
	padding: 14px 16px;
	border: 1px solid #d7e1df;
	border-radius: 14px;
	background: #f7fbfa;
}

.sage-response-recovery-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 12px;
}

.sage-response-recovery-actions button {
	appearance: none;
	border: 1px solid #cfdad8;
	border-radius: 11px;
	padding: 9px 14px;
	background: #fff;
	color: #26302f;
	font: inherit;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
}

.sage-response-recovery-actions .retry-query-btn {
	border-color: #009999;
	background: #009999;
	color: #fff;
}

.sage-response-recovery-actions button:hover,
.sage-response-recovery-actions button:focus-visible {
	outline: 3px solid rgba(0, 153, 153, 0.18);
	outline-offset: 2px;
}

@media (max-width: 520px) {
	.sage-response-recovery-actions {
		align-items: stretch;
	}
	.sage-response-recovery-actions button {
		flex: 1 1 145px;
	}
}

/* Stage D: authenticated SAGE names are profile links; guest labels remain plain text. */
.sage-user-name {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
}
.sage-user-name:hover,
.sage-user-name:focus-visible {
  color: #007f7f;
}
.sage-user-label {
  font-weight: 700;
}

/* Stage E: My SAGE basic actions ------------------------------------------------ */
.sage-basic-action-divider {
  display: inline-block;
  width: 1px;
  height: 26px;
  margin: 0 4px;
  background: #d9e3e2;
  vertical-align: middle;
}

.bot-action-btn.sage-basic-action {
  width: auto;
  min-width: 0;
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.bot-action-btn.sage-basic-action.is-active {
  border-color: #159b96;
  background: #eefafa;
  color: #087a76;
  font-weight: 700;
}

.sage-note-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 34, 33, .48);
}

.sage-note-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border: 1px solid #d7e4e2;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

.sage-note-card h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.sage-note-context {
  margin: 0 0 16px;
  color: #62706f;
}

.sage-note-text {
  box-sizing: border-box;
  width: 100%;
  min-height: 130px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid #cbd8d6;
  border-radius: 12px;
  font: inherit;
}

.sage-note-text:focus {
  outline: 2px solid #159b96;
  outline-offset: 2px;
}

.sage-note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.sage-note-actions button {
  padding: 9px 14px;
  border: 1px solid #cbd8d6;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sage-note-actions .sage-note-save {
  border-color: #079a95;
  background: #079a95;
  color: #fff;
}

@media (max-width: 640px) {
  .sage-basic-action-divider {
    display: none;
  }
  .bot-action-btn.sage-basic-action {
    padding: 7px 10px;
  }
  .sage-note-backdrop {
    align-items: end;
    padding: 12px;
  }
  .sage-note-card {
    max-height: 82vh;
    border-radius: 18px;
  }
}

/* Stage G: semantic action states. */
.bot-actions[data-content-type="recipe_item"] .sage-context-action,
.bot-actions[data-content-type="practice"] .sage-context-action {
  white-space: nowrap;
}

.bot-action-btn.sage-context-action.is-active {
  border-color: #71c9c4;
  background: #edf9f8;
  color: #087a78;
}

@media (max-width: 700px) {
  .bot-actions[data-content-type="recipe_item"] .sage-context-action,
  .bot-actions[data-content-type="practice"] .sage-context-action {
    flex: 0 0 auto;
  }
}

/* Stage I — feedback communication. Additive styles only. */
.feedback-panel {
	box-sizing: border-box;
	width: min(760px, 100%);
	margin-top: 12px;
	padding: 14px;
	border: 1px solid #d8e3e1;
	border-radius: 14px;
	background: #f8fbfa;
}

.feedback-panel-title {
	margin-bottom: 8px;
	font-weight: 700;
	color: #27302f;
}

.feedback-reason-text {
	box-sizing: border-box;
	width: 100%;
	min-height: 86px;
	resize: vertical;
	border: 1px solid #cdd9d7;
	border-radius: 11px;
	padding: 11px 12px;
	font: inherit;
	line-height: 1.45;
	background: #fff;
	color: #27302f;
}

.feedback-reason-text:focus {
	outline: 3px solid rgba(0, 153, 153, 0.16);
	border-color: #009999;
}

.feedback-panel-actions {
	display: flex;
	justify-content: flex-end;
	gap: 9px;
	margin-top: 10px;
}

.feedback-panel-actions button {
	border: 1px solid #cdd9d7;
	border-radius: 10px;
	padding: 9px 13px;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.feedback-cancel-btn {
	background: #fff;
	color: #45504f;
}

.feedback-save-btn {
	background: #009999;
	border-color: #009999 !important;
	color: #fff;
}

.feedback-save-btn:disabled {
	opacity: 0.6;
	cursor: wait;
}

.feedback-confirmation {
	box-sizing: border-box;
	width: min(760px, 100%);
	margin-top: 10px;
	padding: 10px 12px;
	border: 1px solid #bfe5dc;
	border-radius: 11px;
	background: #edf9f5;
	color: #116c60;
	font-weight: 700;
	line-height: 1.4;
}

@media (max-width: 520px) {
	.feedback-panel-actions {
		flex-direction: column-reverse;
	}
	.feedback-panel-actions button {
		width: 100%;
	}
}
