/* GSEWS AI Guide — refined production assistant interface. */
.gsews-ai-guide {
	position: fixed;
	left: max(1rem, env(safe-area-inset-left));
	bottom: max(1rem, calc(env(safe-area-inset-bottom) + 1rem));
	z-index: 9998;
	font-family: var(--gsews-font-body);
}

body.gsews-ai-open { overflow: hidden; }

.gsews-ai-launcher {
	display: inline-flex;
	min-height: 54px;
	align-items: center;
	gap: .68rem;
	padding: .58rem 1rem .58rem .62rem;
	border: 1px solid rgba(255,255,255,.28);
	border-radius: 999px;
	background:
		linear-gradient(135deg, rgba(255,255,255,.12), transparent 38%),
		linear-gradient(135deg, #062754, #0b4f9f 70%, #5746d6);
	color: #fff;
	box-shadow: 0 16px 42px rgba(8,36,74,.32), inset 0 1px 0 rgba(255,255,255,.16);
	font-weight: 800;
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease, opacity .18s ease;
}

.gsews-ai-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 20px 48px rgba(8,54,112,.38), inset 0 1px 0 rgba(255,255,255,.18);
}
.gsews-ai-launcher:focus-visible { outline: 3px solid rgba(255,196,73,.88); outline-offset: 3px; }
.gsews-ai-launcher > span:last-child { display: grid; text-align: left; line-height: 1.12; }
.gsews-ai-launcher strong { color: #fff; font-size: .84rem; letter-spacing: .005em; }
.gsews-ai-launcher small { color: #dcecff; font-size: .66rem; font-weight: 650; }

/* Animated AI emblem shared by launcher and panel header. */
.gsews-ai-orb {
	position: relative;
	display: inline-grid;
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	place-items: center;
	isolation: isolate;
}
.gsews-ai-orb::before,
.gsews-ai-orb::after {
	content: '';
	position: absolute;
	inset: 1px;
	border-radius: 50%;
	pointer-events: none;
}
.gsews-ai-orb::before {
	border: 1px solid rgba(154,225,255,.72);
	box-shadow: 0 0 0 4px rgba(85,171,255,.10), 0 0 22px rgba(87,187,255,.42);
	animation: gsews-ai-ring-pulse 2.8s ease-in-out infinite;
}
.gsews-ai-orb::after {
	inset: -2px;
	border: 1px dashed rgba(255,255,255,.38);
	animation: gsews-ai-orbit-ring 9s linear infinite;
}
.gsews-ai-orb-core {
	position: relative;
	display: grid;
	width: 32px;
	height: 32px;
	place-items: center;
	border-radius: 50%;
	background:
		radial-gradient(circle at 32% 24%, rgba(255,255,255,.94) 0 4%, transparent 5%),
		linear-gradient(145deg, #67dcff 0%, #287eea 45%, #6547e8 100%);
	box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 7px 18px rgba(25,84,189,.38);
	z-index: 2;
	animation: gsews-ai-core-float 3.2s ease-in-out infinite;
}
.gsews-ai-orb-core svg { width: 18px; height: 18px; filter: drop-shadow(0 1px 3px rgba(7,31,85,.35)); }
.gsews-ai-orb-dot {
	position: absolute;
	width: 5px;
	height: 5px;
	border: 1px solid rgba(255,255,255,.75);
	border-radius: 50%;
	background: #ffe28a;
	box-shadow: 0 0 8px rgba(255,226,138,.9);
	z-index: 3;
}
.gsews-ai-orb-dot.is-one { top: 2px; right: 5px; animation: gsews-ai-dot-one 3.6s ease-in-out infinite; }
.gsews-ai-orb-dot.is-two { left: 1px; bottom: 8px; width: 4px; height: 4px; background: #9af3ff; animation: gsews-ai-dot-two 4.2s ease-in-out infinite; }
.gsews-ai-orb--header { width: 46px; height: 46px; flex-basis: 46px; }
.gsews-ai-orb--header .gsews-ai-orb-core { width: 35px; height: 35px; }
.gsews-ai-brand-emblem { position: relative; display: inline-grid; flex: 0 0 auto; place-items: center; }
.gsews-ai-brand-mini {
	position: absolute;
	right: -3px;
	bottom: -2px;
	display: grid;
	width: 19px;
	height: 19px;
	place-items: center;
	overflow: hidden;
	border: 2px solid #fff;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 3px 9px rgba(4,28,64,.28);
	z-index: 5;
}
.gsews-ai-brand-mini img { width: 100%; height: 100%; padding: 0; border-radius: 50%; background: #fff; object-fit: contain; }

.gsews-ai-panel {
	position: absolute;
	left: 0;
	bottom: calc(100% + .8rem);
	display: grid;
	width: min(430px, calc(100vw - 2rem));
	height: min(680px, calc(100vh - 8.5rem));
	grid-template-rows: auto auto minmax(150px, 1fr) auto auto auto;
	overflow: hidden;
	border: 1px solid rgba(155,180,211,.82);
	border-radius: 1.35rem;
	background: #fff;
	box-shadow: 0 28px 78px rgba(8,36,74,.30), 0 4px 18px rgba(8,36,74,.10);
	opacity: 0;
	transform: translateY(.7rem) scale(.98);
	transform-origin: bottom left;
	transition: opacity .2s ease, transform .2s ease;
}
.gsews-ai-panel[hidden] { display: none; }
.gsews-ai-panel.is-open { opacity: 1; transform: none; }

.gsews-ai-header {
	position: relative;
	display: flex;
	min-height: 72px;
	align-items: center;
	justify-content: space-between;
	gap: .8rem;
	overflow: hidden;
	padding: .82rem 1rem;
	background:
		radial-gradient(circle at 92% 10%, rgba(128,199,255,.32), transparent 32%),
		radial-gradient(circle at 10% 120%, rgba(109,76,230,.30), transparent 42%),
		linear-gradient(135deg, #052653, #0b4b98 68%, #403cb5);
	color: #fff;
}
.gsews-ai-header::after {
	content: '';
	position: absolute;
	width: 140px;
	height: 140px;
	right: -68px;
	top: -85px;
	border: 1px solid rgba(255,255,255,.16);
	border-radius: 50%;
	box-shadow: 0 0 0 18px rgba(255,255,255,.035), 0 0 0 38px rgba(255,255,255,.025);
	pointer-events: none;
}
.gsews-ai-title-wrap { position: relative; z-index: 2; display: flex; min-width: 0; align-items: center; gap: .78rem; }
.gsews-ai-title-wrap > span:last-child { display: grid; min-width: 0; }
.gsews-ai-header strong { color: #fff; font-family: var(--gsews-font-heading); font-size: 1rem; letter-spacing: .002em; }
.gsews-ai-header small { color: #dcecff; font-size: .73rem; }
.gsews-ai-header .gsews-ai-status { display:flex; align-items:center; gap:.35rem; margin-top:.12rem; color:#ffe09d; font-size:.63rem; font-weight:760; letter-spacing:.025em; }
.gsews-ai-status i { width:.45rem; height:.45rem; border-radius:50%; background:#62e8a8; box-shadow:0 0 0 4px rgba(98,232,168,.14); animation:gsews-ai-status-pulse 2.4s ease-in-out infinite; }
.gsews-ai-header > button {
	position: relative;
	z-index: 3;
	display: inline-grid;
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	place-items: center;
	border: 1px solid rgba(255,255,255,.18);
	border-radius: 50%;
	background: rgba(255,255,255,.11);
	color: #fff;
	cursor: pointer;
	transition: background .18s ease, transform .18s ease;
}
.gsews-ai-header > button:hover { background: rgba(255,255,255,.22); transform: rotate(4deg); }
.gsews-ai-header > button:focus-visible { outline: 3px solid #ffd37a; outline-offset: 2px; }

.gsews-ai-disclaimer {
	display: flex;
	align-items: flex-start;
	gap: .55rem;
	padding: .65rem .9rem;
	border-bottom: 1px solid #ead8b8;
	background: linear-gradient(90deg, #fff8e8, #fffdf6);
	color: #634510;
	font-size: .72rem;
	line-height: 1.42;
}
.gsews-ai-disclaimer .gsews-icon { margin-top: .1rem; color: #d97706; }
.gsews-ai-disclaimer p { margin: 0; }

.gsews-ai-messages {
	display: flex;
	min-height: 0;
	flex-direction: column;
	gap: .82rem;
	overflow-y: auto;
	padding: .9rem;
	background:
		linear-gradient(rgba(245,249,254,.88), rgba(250,252,255,.94)),
		radial-gradient(circle at 12px 12px, rgba(13,91,185,.055) 1px, transparent 1.5px) 0 0 / 24px 24px;
	overscroll-behavior: contain;
	scrollbar-gutter: stable;
	scrollbar-width: thin;
	scrollbar-color: #b7c9df transparent;
}
.gsews-ai-messages::-webkit-scrollbar { width: 6px; }
.gsews-ai-messages::-webkit-scrollbar-thumb { border-radius: 999px; background: #b7c9df; }

.gsews-ai-message {
	width: min(94%, 35rem);
	padding: .82rem .88rem;
	border: 1px solid #d8e3ef;
	border-radius: 1rem 1rem 1rem .28rem;
	background: rgba(255,255,255,.96);
	box-shadow: 0 8px 22px rgba(10,50,104,.07);
	color: var(--gsews-text);
	font-size: .86rem;
	line-height: 1.58;
	animation: gsews-ai-arrive .22s ease both;
}
.gsews-ai-message.is-user {
	width: min(84%, 28rem);
	align-self: flex-end;
	border-color: #bcd4f0;
	border-radius: 1rem 1rem .28rem 1rem;
	background: linear-gradient(135deg, #edf5ff, #e5efff);
	box-shadow: 0 7px 18px rgba(29,91,168,.08);
}
.gsews-ai-message.is-pending { color: var(--gsews-text-light); }
.gsews-ai-message.is-pending::after {
	content: '';
	display: inline-block;
	width: 1.1rem;
	height: .35rem;
	margin-left: .35rem;
	background: radial-gradient(circle, currentColor 42%, transparent 46%) 0 50% / .35rem .35rem repeat-x;
	animation: gsews-ai-searching .9s steps(3) infinite;
	vertical-align: .05rem;
}
.gsews-ai-badge {
	display: inline-flex;
	margin-bottom: .5rem;
	padding: .22rem .48rem;
	border: 1px solid #ccebdd;
	border-radius: 999px;
	background: #eaf9f2;
	color: #056648;
	font-size: .6rem;
	font-weight: 850;
	letter-spacing: .045em;
	line-height: 1.35;
}
.gsews-ai-response-title {
	margin: 0 0 .5rem;
	color: var(--gsews-primary-dark);
	font-family: var(--gsews-font-heading);
	font-size: .96rem;
	line-height: 1.3;
}
.gsews-ai-answer-content { display: grid; gap: .52rem; }
.gsews-ai-answer-content p { margin: 0; }
.gsews-ai-answer-main-title {
	margin: .05rem 0 .05rem;
	color: var(--gsews-heading);
	font-family: var(--gsews-font-heading);
	font-size: 1rem;
	line-height: 1.32;
}
.gsews-ai-answer-section {
	margin: .18rem 0 -.18rem;
	color: #0b4f9f;
	font-family: var(--gsews-font-heading);
	font-size: .76rem;
	font-weight: 800;
	letter-spacing: .015em;
	line-height: 1.35;
}
.gsews-ai-answer-list { display: grid; gap: .28rem; margin: 0; padding-left: 1.15rem; }
.gsews-ai-answer-list li { padding-left: .08rem; }
.gsews-ai-answer-note {
	padding: .55rem .62rem;
	border-left: 3px solid #e6a52b;
	border-radius: .35rem;
	background: #fff9eb;
	color: #694b17;
}

.gsews-ai-sources { margin-top: .75rem; padding-top: .68rem; border-top: 1px solid var(--gsews-border); }
.gsews-ai-sources > strong { display: block; margin-bottom: .44rem; color: var(--gsews-heading); font-size: .74rem; }
.gsews-ai-source-list { display: grid; gap: .4rem; }
.gsews-ai-source-card {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	padding: .52rem .6rem;
	border: 1px solid var(--gsews-border);
	border-radius: .62rem;
	background: #fff;
	color: var(--gsews-primary-dark);
	line-height: 1.35;
	text-decoration: none;
	transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.gsews-ai-source-card span { overflow: hidden; font-size: .76rem; font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.gsews-ai-source-card small { grid-column: 1; color: var(--gsews-text-light); font-size: .66rem; }
.gsews-ai-external-icon { grid-column: 2; grid-row: 1 / span 2; width: .9rem; height: .9rem; align-self: center; margin-left: .4rem; }
.gsews-ai-source-card:hover { border-color: #9fc2ec; background: #f7fbff; transform: translateY(-1px); }

/* Quick-question carousel with arrows, native touch scrolling, and a visible progress track. */
.gsews-ai-quick {
	padding: .48rem .72rem .55rem;
	border-top: 1px solid #dce6f1;
	background: #f8fbff;
}
.gsews-ai-quick-head { display:flex; align-items:center; justify-content:space-between; gap:.6rem; margin-bottom:.38rem; }
.gsews-ai-quick-head strong { color:var(--gsews-heading); font-size:.7rem; }
.gsews-ai-quick-head small { color:var(--gsews-text-light); font-size:.61rem; }
.gsews-ai-quick-row { display:grid; grid-template-columns:30px minmax(0,1fr) 30px; align-items:center; gap:.34rem; }
.gsews-ai-suggestion-nav {
	display:inline-grid;
	width:30px;
	height:30px;
	place-items:center;
	border:1px solid #bed1e8;
	border-radius:50%;
	background:#fff;
	color:var(--gsews-primary-dark);
	cursor:pointer;
	box-shadow:0 3px 10px rgba(10,50,104,.06);
}
.gsews-ai-suggestion-nav .gsews-icon { width:.85rem; height:.85rem; }
.gsews-ai-suggestion-nav:hover:not(:disabled) { background:var(--gsews-primary-soft); border-color:#91b7e4; }
.gsews-ai-suggestion-nav:disabled { cursor:default; opacity:.35; }
.gsews-ai-suggestions {
	display: flex;
	gap: .42rem;
	overflow-x: auto;
	padding: .1rem .02rem .38rem;
	scroll-snap-type: x proximity;
	overscroll-behavior-x: contain;
	scrollbar-width: thin;
	scrollbar-color: #91afd2 #e5edf7;
}
.gsews-ai-suggestions::-webkit-scrollbar { height: 5px; }
.gsews-ai-suggestions::-webkit-scrollbar-track { border-radius:999px; background:#e5edf7; }
.gsews-ai-suggestions::-webkit-scrollbar-thumb { border-radius:999px; background:#91afd2; }
.gsews-ai-suggestions button {
	min-height: 34px;
	flex: 0 0 auto;
	padding: .38rem .65rem;
	border: 1px solid #bfd3ed;
	border-radius: 999px;
	background: #fff;
	color: var(--gsews-primary-dark);
	font-size: .7rem;
	font-weight: 760;
	cursor: pointer;
	scroll-snap-align: start;
	white-space: nowrap;
	transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.gsews-ai-suggestions button:hover { border-color:#8eb5e2; background:var(--gsews-primary-soft); transform:translateY(-1px); }
.gsews-ai-suggestion-progress { position:relative; height:3px; margin:.28rem 2.25rem 0; overflow:hidden; border-radius:999px; background:#e1eaf5; }
.gsews-ai-suggestion-progress span { display:block; width:30%; height:100%; border-radius:inherit; background:linear-gradient(90deg,#1d7ddd,#6650df); transform:translateX(0); transition:width .16s ease, transform .16s ease; }

.gsews-ai-form {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 46px;
	gap: .5rem;
	padding: .68rem .82rem;
	border-top: 1px solid var(--gsews-border);
	background: #fff;
}
.gsews-ai-form textarea {
	width: 100%;
	min-height: 46px;
	max-height: 112px;
	resize: vertical;
	padding: .67rem .72rem;
	border: 1px solid #b9c8da;
	border-radius: .72rem;
	background: #fff;
	color: var(--gsews-text);
	font-size: .82rem;
	line-height: 1.4;
}
.gsews-ai-form textarea:focus { border-color:#6fa4df; outline:3px solid rgba(35,118,211,.13); }
.gsews-ai-form button {
	display: inline-grid;
	width: 46px;
	height: 46px;
	place-items: center;
	align-self: end;
	border: 0;
	border-radius: .72rem;
	background: linear-gradient(145deg, var(--gsews-primary), #5144cf);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 7px 16px rgba(25,82,160,.20);
}
.gsews-ai-form button:hover { background:linear-gradient(145deg,var(--gsews-primary-dark),#4035b5); }
.gsews-ai-form button:disabled { cursor: wait; opacity: .58; }

.gsews-ai-actions {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	border-top: 1px solid var(--gsews-border);
	background: var(--gsews-bg-soft);
}
.gsews-ai-actions a {
	display: inline-flex;
	min-height: 42px;
	align-items: center;
	justify-content: center;
	gap: .3rem;
	padding: .42rem .28rem;
	border-right: 1px solid var(--gsews-border);
	color: var(--gsews-primary-dark);
	font-size: .68rem;
	font-weight: 760;
	text-decoration: none;
}
.gsews-ai-actions a:last-child { border-right: 0; }
.gsews-ai-actions a:hover { background: var(--gsews-primary-soft); }

@media (max-width: 768px) {
	.gsews-ai-guide { inset: auto 0 0; z-index: 10001; pointer-events:none; }
	.gsews-ai-launcher,
	.gsews-ai-panel { pointer-events:auto; }
	.gsews-ai-launcher {
		position: fixed;
		left: max(.75rem, env(safe-area-inset-left));
		bottom: max(.75rem, calc(env(safe-area-inset-bottom) + .75rem));
		padding: .53rem .82rem .53rem .57rem;
	}
	.gsews-ai-guide.is-open .gsews-ai-launcher { opacity:0; pointer-events:none; transform:translateY(.6rem) scale(.94); }
	.gsews-ai-panel {
		position: fixed;
		left: max(.55rem, env(safe-area-inset-left));
		right: max(.55rem, env(safe-area-inset-right));
		bottom: max(.55rem, calc(env(safe-area-inset-bottom) + .55rem));
		width: auto;
		height: min(74dvh, 630px);
		max-height: calc(100dvh - 4.6rem);
		border: 1px solid rgba(155,180,211,.88);
		border-radius: 1.35rem;
		padding-bottom: 0;
		transform: translateY(1rem) scale(.985);
		transform-origin: bottom center;
		overscroll-behavior: contain;
	}
	.gsews-ai-panel.is-open { transform:none; }
	.gsews-ai-header { min-height:68px; padding:.72rem .82rem; }
	.gsews-ai-orb--header { width:42px; height:42px; flex-basis:42px; }
	.gsews-ai-orb--header .gsews-ai-orb-core { width:32px; height:32px; }
	.gsews-ai-header strong { font-size:.94rem; }
	.gsews-ai-header small { font-size:.68rem; }
	.gsews-ai-disclaimer { padding:.52rem .7rem; font-size:.65rem; line-height:1.38; }
	.gsews-ai-messages { padding:.72rem; gap:.7rem; }
	.gsews-ai-message { width:96%; padding:.72rem .76rem; font-size:.82rem; }
	.gsews-ai-message.is-user { width:86%; }
	.gsews-ai-quick { padding:.42rem .58rem .5rem; }
	.gsews-ai-quick-head small { display:none; }
	.gsews-ai-form { padding:.58rem .68rem; }
	.gsews-ai-actions a { min-height:40px; font-size:.64rem; }
}

@media (max-width: 380px) {
	.gsews-ai-launcher small { display: none; }
	.gsews-ai-launcher strong { font-size: .76rem; }
	.gsews-ai-panel { left:.38rem; right:.38rem; bottom:max(.38rem,calc(env(safe-area-inset-bottom) + .38rem)); height:min(76dvh,600px); max-height:calc(100dvh - 3.6rem); }
	.gsews-ai-title-wrap { gap:.58rem; }
	.gsews-ai-header .gsews-ai-status { font-size:.59rem; }
	.gsews-ai-quick-row { grid-template-columns:28px minmax(0,1fr) 28px; }
	.gsews-ai-suggestion-nav { width:28px; height:28px; }
}

@media (max-height: 650px) and (max-width: 900px) {
	.gsews-ai-panel { height:min(82dvh,540px); max-height:calc(100dvh - 1rem); }
	.gsews-ai-disclaimer { display:none; }
}

@keyframes gsews-ai-searching { 0% { width: .35rem; } 100% { width: 1.1rem; } }
@keyframes gsews-ai-arrive { from { opacity:0; transform:translateY(.28rem) scale(.995); } to { opacity:1; transform:none; } }
@keyframes gsews-ai-ring-pulse { 0%,100% { transform:scale(.96); opacity:.72; } 50% { transform:scale(1.05); opacity:1; } }
@keyframes gsews-ai-orbit-ring { to { transform:rotate(360deg); } }
@keyframes gsews-ai-core-float { 0%,100% { transform:translateY(0) rotate(-2deg); } 50% { transform:translateY(-1.5px) rotate(2deg); } }
@keyframes gsews-ai-dot-one { 0%,100% { transform:translate(0,0) scale(.8); } 50% { transform:translate(-3px,3px) scale(1.15); } }
@keyframes gsews-ai-dot-two { 0%,100% { transform:translate(0,0); opacity:.55; } 50% { transform:translate(3px,-2px); opacity:1; } }
@keyframes gsews-ai-status-pulse { 0%,100% { box-shadow:0 0 0 3px rgba(98,232,168,.12); } 50% { box-shadow:0 0 0 6px rgba(98,232,168,.04); } }

@media (prefers-reduced-motion: reduce) {
	.gsews-ai-panel,
	.gsews-ai-launcher,
	.gsews-ai-source-card,
	.gsews-ai-suggestions button,
	.gsews-ai-suggestion-progress span { transition:none; }
	.gsews-ai-orb::before,
	.gsews-ai-orb::after,
	.gsews-ai-orb-core,
	.gsews-ai-orb-dot,
	.gsews-ai-status i,
	.gsews-ai-message,
	.gsews-ai-message.is-pending::after { animation:none; }
}

/* Explicit SVG sizing prevents browser-default 300×150 dimensions. */
.gsews-ai-header > button .gsews-icon,
.gsews-ai-form button .gsews-icon { width:1.2rem; height:1.2rem; }
.gsews-ai-disclaimer .gsews-icon { width:1rem; height:1rem; flex:0 0 1rem; }
.gsews-ai-actions .gsews-icon { width:.86rem; height:.86rem; flex:0 0 .86rem; }
