/**
 * utility-panel-contract.css
 *
 * Authoritative Settings + Watcher utility-panel contract.
 * Loaded after theme CSS so geometry and typography parity win.
 */

/* --- Panel shell + placement (structural) --- */
#settingsScreen,
#watcherScreen{
	top: calc(var(--site-navbar-offset, 48px) + var(--utility-panel-top-gap, 8px)) !important;
	margin: 0 15px 15px 0 !important;
	box-sizing: border-box !important;
	max-height: calc(100vh - var(--site-navbar-offset, 48px) - var(--utility-panel-top-gap, 8px) - 16px) !important;
	opacity: 1 !important;
	filter: none !important;
	background-image: var(--theme-settings-panel-bg-image, none) !important;
	/* Panel surfaces must be fully opaque; --theme-settings-panel-bg must be rgb/hex (not alpha). */
	background-color: var(--theme-settings-panel-bg-solid, var(--theme-settings-panel-bg, var(--theme-body-bg-color))) !important;
	color: var(--theme-settings-panel-fg, var(--theme-content-fg)) !important;
	border: var(--theme-settings-panel-border, 1px solid var(--theme-overlay-border, var(--theme-reply-border, rgba(0, 0, 0, 0.25)))) !important;
	box-shadow: var(--theme-floating-panel-shadow) !important;
	border-radius: var(--theme-settings-panel-radius, 3px) !important;
	text-shadow: var(--theme-settings-panel-text-shadow, none);
	font-family: var(--theme-font-body, arial, helvetica, sans-serif) !important;
	font-size: 10pt !important;
	font-style: normal !important;
	font-weight: normal !important;
	line-height: 1.25 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	word-spacing: normal !important;
	--theme-checkbox-cutout-color: var(--theme-settings-panel-bg, var(--theme-body-bg-color));
}

#watcherScreen{
	z-index: 20 !important;
	width: var(--utility-watcher-panel-width, 533px) !important;
	max-width: min(var(--utility-watcher-panel-width, 533px), 95vw) !important;
}

#settingsScreen{
	z-index: 21 !important;
	width: var(--utility-settings-panel-width, 342px) !important;
	max-width: min(var(--utility-settings-panel-width, 342px), 95vw) !important;
}

/* Panel prose: suppress decorative text-shadow on non-heading content */
#settingsScreen :not(.utility-panel-title):not(h2),
#watcherScreen :not(.utility-panel-title):not(h2){
	text-shadow: none;
}

#watcherScreen .watcherMenu{
	font-family: var(--theme-font-body, arial, helvetica, sans-serif) !important;
	font-size: 10pt !important;
	font-style: normal !important;
	font-weight: normal !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	word-spacing: normal !important;
	line-height: 1.25 !important;
}

/* --- Shared utility-panel header chrome --- */
#settingsScreen .utility-panel-header,
#watcherScreen .utility-panel-header{
	position: relative;
	padding: 0.5em 0.5em 0;
}

#settingsScreen .utility-panel-header-row,
#watcherScreen .utility-panel-header-row{
	position: relative;
	display: block;
	box-sizing: border-box;
	min-height: 1.15em;
	margin: 0;
	padding: 0;
	font-size: 32px !important;
	line-height: 1.1 !important;
	text-align: center;
}

#settingsScreen .utility-panel-header > hr,
#watcherScreen .utility-panel-header > hr{
	margin: 0.15em 0.5em 0.5em;
	border-color: var(--theme-hr);
	clear: both;
}

#settingsScreen .utility-panel-title,
#watcherScreen .utility-panel-title,
#settingsScreen h2,
#watcherScreen h2{
	font-family: var(--theme-masthead-font-family, var(--theme-font-heading, inherit)) !important;
	font-weight: var(--theme-masthead-font-weight, var(--theme-heading-weight, normal)) !important;
	font-style: var(--theme-masthead-font-style, var(--theme-heading-style, normal)) !important;
	letter-spacing: var(--theme-masthead-letter-spacing, var(--theme-heading-letter-spacing, normal)) !important;
	word-spacing: var(--theme-masthead-word-spacing, var(--theme-heading-word-spacing, normal)) !important;
	text-transform: var(--theme-masthead-text-transform, var(--theme-heading-text-transform, none)) !important;
	color: var(--theme-masthead-color, var(--theme-heading, inherit)) !important;
	text-shadow: var(--theme-masthead-text-shadow, var(--theme-heading-shadow, none)) !important;
}

#settingsScreen .utility-panel-title,
#watcherScreen .utility-panel-title{
	line-height: 1.1 !important;
	text-align: center !important;
	display: block;
	width: 100%;
	margin: 0 !important;
	padding: 0 !important;
}

/* Panel header close: 1.5× wunwatch, top-right of header row */
#settingsScreen .utility-panel-header-row > .settings-close-button.wunwatch,
#watcherScreen .utility-panel-header-row > .settings-close-button.wunwatch{
	position: absolute;
	top: 0;
	right: 0;
	transform: none;
	font-size: 13.5pt;
}

/* --- Section subheadings: layout only (typography shared above) --- */
#settingsScreen h2,
#watcherScreen h2{
	line-height: inherit !important;
	margin: 0 !important;
	text-decoration: none !important;
	border: none !important;
	border-bottom: none !important;
	background: none !important;
	background-color: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
}

#settingsScreen h2::before,
#settingsScreen h2::after,
#watcherScreen h2::before,
#watcherScreen h2::after{
	content: none !important;
	display: none !important;
	border: none !important;
	background: none !important;
	background-image: none !important;
	box-shadow: none !important;
}

/* --- Top-level panel content sections --- */
#settingsScreen > section,
#watcherScreen .watcherMenu > section{
	padding: 0 0.5em 0.3em !important;
	margin: 0;
}

/* --- Settings rows: Big Mac reference typography/spacing (color stays semantic) --- */
#settingsScreen .setting_section{
	margin-bottom: 0.5em !important;
}

#settingsScreen .setting_row{
	display: flex !important;
	align-items: baseline !important;
	flex-wrap: wrap !important;
	gap: var(--control-inline-gap) !important;
	padding: 0 0.5ex !important;
	margin: 0 !important;
	font-family: var(--theme-font-body, arial, helvetica, sans-serif) !important;
	font-size: 10pt !important;
	font-style: normal !important;
	font-weight: normal !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	word-spacing: normal !important;
	line-height: 1.25 !important;
	text-shadow: none !important;
}

#settingsScreen .setting_row span,
#settingsScreen .setting_row label{
	color: var(--theme-settings-label-color, var(--theme-settings-panel-fg, var(--theme-content-fg))) !important;
	font-family: inherit !important;
	font-size: inherit !important;
	font-style: inherit !important;
	font-weight: var(--theme-settings-label-weight, inherit) !important;
	text-transform: inherit !important;
	letter-spacing: inherit !important;
	word-spacing: inherit !important;
	line-height: inherit !important;
	text-shadow: none !important;
}

#settingsScreen .setting_row > input[type="checkbox"],
#settingsScreen .setting_row > input[type="radio"]{
	margin-inline-end: 0 !important;
}

#settingsScreen .setting_row button{
	margin-left: 0 !important;
}

#settingsScreen .setting_more_details,
#settingsScreen .disable_message,
#watcherScreen .watcherMenu,
#watcherScreen .watcherMenu > section,
#watcherScreen .wstatus,
#watcherScreen .wempty,
#watcherScreen .wcounterror{
	color: var(--theme-settings-panel-fg, var(--theme-content-fg)) !important;
	font-family: var(--theme-font-body, arial, helvetica, sans-serif) !important;
	font-size: 10pt !important;
	font-style: normal !important;
	font-weight: normal !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	word-spacing: normal !important;
	line-height: 1.25 !important;
	text-shadow: none !important;
}

/* --- In-panel links --- */
#settingsScreen a,
#settingsScreen a:visited,
#watcherScreen a,
#watcherScreen a:visited{
	color: var(--theme-link) !important;
	font-family: inherit !important;
	font-size: inherit !important;
	font-style: inherit !important;
	font-weight: inherit !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	word-spacing: normal !important;
	text-shadow: none !important;
}

#settingsScreen a:hover,
#settingsScreen a:focus,
#watcherScreen a:hover,
#watcherScreen a:focus{
	color: var(--theme-link-hover) !important;
}

/* Settings/Watcher form controls: defer chrome (border, radius, bg, shadow, focus)
   to theme/page/module cascade. Do not normalize control appearance here.
   Compact row/control spacing is owned by .setting_row rules above. */

/* Settings-only control radius contract (intentionally overrides theme square controls) */
#settingsScreen input:not([type="checkbox"]):not([type="radio"]),
#settingsScreen select,
#settingsScreen textarea,
#settingsScreen button{
	border-radius: var(--utility-settings-control-radius, 4px) !important;
}

#settingsScreen input[type="file"]::file-selector-button{
	border-radius: var(--utility-settings-control-radius, 4px) !important;
}

/* Theme selector: fit longest active theme label without clipping */
#settingsScreen select.setting-style-select{
	box-sizing: border-box;
	width: auto;
	max-width: 100%;
	min-width: 14em;
	min-width: max(14em, -webkit-min-content);
	min-width: max(14em, min-content);
	field-sizing: content;
	line-height: normal;
	min-height: 2em;
	padding-block: 0.2em;
	padding-inline: 0.35em 1.75em;
	overflow: visible;
}

#settingsScreen input:disabled,
#settingsScreen textarea:disabled,
#settingsScreen select:disabled,
#settingsScreen button:disabled,
#watcherScreen input:disabled,
#watcherScreen textarea:disabled,
#watcherScreen select:disabled,
#watcherScreen button:disabled{
	opacity: var(--theme-form-disabled-opacity, 0.6);
	cursor: not-allowed;
}

/* --- Legacy Settings-only title selectors: defer to utility-panel-title --- */
#settingsScreen h1:not(.utility-panel-title){
	font-family: inherit;
	font-weight: inherit;
	letter-spacing: inherit;
	text-transform: none;
	margin: 0;
	padding: 0;
	background: none;
	border: none;
}

/* --- Utility heading sizes (authoritative) ---
 * Final rules in this module: beat theme h1/h2 and font: shorthand.
 * Themes own family/weight/style/color/shadow/letter-spacing only. */
#settingsScreen h1.utility-panel-title,
#watcherScreen h1.utility-panel-title,
#settingsScreen .utility-panel-title,
#watcherScreen .utility-panel-title{
	font-size: 32px !important;
}

#settingsScreen h2,
#watcherScreen h2{
	font-size: 20px !important;
}
