/* ============================================================
   HelpDesk AI Summary Styles
   Shared by: ticket_history, daterange, and any future
   Claude-powered summary panels.
   ============================================================ */

/* Container */
.ai-summary-box {
	margin: 0 0 14px;
	padding: 12px 16px;
	background: var(--bg-panel);
	border: 1px solid #c8e6c9;
	border-radius: 2px;
}

/* Section label (e.g. "✨ AI Customer History Summary") */
.ai-summary-box .ai-summary-header {
	font-size: 10px;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: #2e7d32;
	margin-bottom: 8px;
}

/* Panel title rows inside the generated HTML */
.ai-summary-box .rs-panel-title {
	font-size: 10px;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--text-muted);
	margin: 10px 0 6px;
}
.ai-summary-box .rs-panel-title:first-child { margin-top: 0; }

/* Observation items — two-column: label right-aligned, description left-aligned */
.ai-summary-box .rs-obs-item {
	display: flex;
	align-items: baseline;
	gap: 20px;
	margin-bottom: 7px;
	padding: 6px 12px;
	border-left: 4px solid var(--border-medium);
	font-size: 12px;
	line-height: 1.7;
	color: var(--text-secondary);
}
.ai-summary-box .rs-obs-item strong {
	flex: 0 0 400px;
	text-align: right;
	font-weight: bold;
}
.ai-summary-box .rs-obs-item .rs-obs-desc {
	flex: 1;
	text-align: left;
}
.ai-summary-box .rs-obs-item.rs-good   { border-left-color: #1e8449; background: #f6fbf6; }
.ai-summary-box .rs-obs-item.rs-warn   { border-left-color: #d68910; background: #fffdf3; }
.ai-summary-box .rs-obs-item.rs-alert  { border-left-color: #c0392b; background: #fff8f8; }
.ai-summary-box .rs-obs-item.rs-info   { border-left-color: #1a4e8a; background: #f4f7fc; }
.ai-summary-box .rs-obs-item.rs-access { border-left-color: #6a0dad; background: #f8f0ff; color: #3b006b; font-weight: bold; }

/* Model/token footnote */
.ai-summary-box .ai-summary-footnote {
	display: none;
	margin-top: 8px;
	font-size: 10px;
	color: #aaa;
	text-align: right;
}

/* ============================================================
   HelpDesk Intelligence — Bottom Flyout (custdetail.pl)
   ============================================================ */

body.has-ai-flyout {
	padding-bottom: 36px; /* reserve space for collapsed flyout header */
}

body.has-ai-flyout .ticket-popout,
body.has-ai-flyout .ticket-popout-left {
	bottom: 39px; /* clear collapsed flyout header (36px) + original 3px gap */
}

#ai-flyout {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 9500;
	background: var(--bg-panel);
	border-top: 1px solid var(--border-dark);
	box-shadow: 0 -6px 16px rgba(0,0,0,0.22);
	font-family: Helvetica, Arial, sans-serif;
}

/* Inherit rs-obs-item styles inside the flyout body */
#ai-flyout-body .rs-obs-item {
	display: flex;
	align-items: baseline;
	gap: 20px;
	margin-bottom: 7px;
	padding: 6px 12px;
	border-left: 4px solid var(--border-medium);
	font-size: 12px;
	line-height: 1.7;
	color: var(--text-secondary);
}
#ai-flyout-body .rs-obs-item strong {
	flex: 0 0 400px;
	text-align: right;
	font-weight: bold;
}
#ai-flyout-body .rs-obs-item .rs-obs-desc {
	flex: 1;
	text-align: left;
}
#ai-flyout-body .rs-obs-item.rs-good   { border-left-color: #1e8449; background: #f6fbf6; }
#ai-flyout-body .rs-obs-item.rs-warn   { border-left-color: #d68910; background: #fffdf3; }
#ai-flyout-body .rs-obs-item.rs-alert  { border-left-color: #c0392b; background: #fff8f8; }
#ai-flyout-body .rs-obs-item.rs-info   { border-left-color: #1a4e8a; background: #f4f7fc; }
#ai-flyout-body .rs-obs-item.rs-access { border-left-color: #6a0dad; background: #f8f0ff; color: #3b006b; font-weight: bold; }
#ai-flyout-body .rs-panel-title {
	font-size: 11px;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--text-muted);
	margin: 10px 0 6px;
}
#ai-flyout-body .rs-panel-title:first-child { margin-top: 0; }

#ai-flyout-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 16px 8px;
	line-height: 1;
	background: #818f9a;
	color: #fff;
	cursor: default;
	user-select: none;
	font-family: verdana, arial, helvetica, sans-serif;
	font-size: 11px;
	font-weight: bold;
	letter-spacing: 0.5px;
	text-shadow: 0 1px 1px rgba(0,0,0,0.4);
}

#ai-flyout-header-left {
	flex: 1;
	cursor: pointer;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#ai-flyout-header .ai-flyout-cname {
	font-weight: normal;
	opacity: 0.85;
	margin-left: 6px;
	text-transform: none;
	letter-spacing: 0;
}

#ai-flyout-drag {
	flex: 0 0 auto;
	padding: 0 32px;
	cursor: row-resize;
	opacity: 0.5;
	font-size: 13px;
	line-height: 1;
}
#ai-flyout-drag:hover {
	opacity: 0.85;
}

#ai-flyout-header-right {
	flex: 1;
	text-align: right;
}

#ai-flyout-toggle {
	font-size: 10px;
	opacity: 0.75;
	cursor: pointer;
}
#ai-flyout-toggle i {
	margin-right: 4px;
}

#ai-flyout-body {
	max-height: 180px;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 14px 18px;
	box-sizing: border-box;
	transition: max-height 0.25s ease-out, padding 0.25s ease-out;
	margin: 0;
	border: none;
	border-radius: 0;
	background: var(--bg-panel);
	font-size: 12px;
}

#ai-flyout-body.collapsed {
	max-height: 0 !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	overflow: hidden;
}

/* Loading spinner */
@keyframes aispin { to { transform: rotate(360deg); } }
.ai-spinner {
	display: inline-block;
	width: 11px;
	height: 11px;
	border: 2px solid #a5d6a7;
	border-top-color: #2e7d32;
	border-radius: 50%;
	animation: aispin .7s linear infinite;
	margin-right: 6px;
	vertical-align: middle;
}

/* Spinner inside the flyout header bar — white palette */
#ai-flyout-spinner {
	font-weight: normal;
	text-transform: none;
	letter-spacing: 0;
	opacity: 0.85;
	font-size: 11px;
	margin-left: 14px;
}
#ai-flyout-spinner .ai-spinner {
	border-color: rgba(255,255,255,0.35);
	border-top-color: #fff;
}
