/*
 * @futurity/design — classic/bootstrap3.css: Bootstrap 3 adapter for the Fty look.
 *
 * WHAT
 *   Makes stock Bootstrap 3 markup (buttons, forms, input groups, tables, tabs/pills, breadcrumbs, dropdowns,
 *   modals, alerts, labels, badges, panels, wells, pagination, progress bars, tooltips, popovers) render like
 *   the Fty components, with no markup change in the host app. Loading this file IS the opt-in: it is not
 *   scoped to `.fty-classic`.
 *
 * BOOTSTRAP VERSIONS TARGETED
 *   3.1.0 (Orion v5 dashboard) and 3.3.6 / 3.3.7 (Orion SelfReporter). Where the two differ, both selector
 *   shapes are mirrored (e.g. 3.1 paints striped/hovered table CELLS, 3.3 paints ROWS; 3.1 uses
 *   `.open .dropdown-toggle`, 3.3 `.open > .dropdown-toggle`; 3.1 has `input[type="date"] { line-height: 34px }`).
 *
 * LOAD ORDER (after the host's bootstrap.css)
 *   bootstrap.css → tokens.css (optional) → classic.css → classic/bootstrap3.css
 *
 * HOW IT WINS
 *   Every rule mirrors the Bootstrap selector it overrides at the SAME specificity, so it wins because it loads
 *   later. No !important. Where Bootstrap repeats a colour per variant and per state (.btn-primary:active:hover
 *   …), the adapter writes one state rule on `.btn` that reads per-variant custom properties — the same
 *   `--fty-btn-*` hooks `.fty-c-btn` uses in classic.css (plus --fty-btn-hover-fg / --fty-btn-hover-border).
 *   Labels use --fty-label-bg / --fty-label-fg; panels use --fty-accent (the `.fty-c-card--accent` hook).
 *
 * GEOMETRY
 *   Only button and field heights/paddings change (buttons md 36 / sm 32 / lg 40 / xs 24; fields 36 / 32 / 40),
 *   plus the paddings of the restyled widgets (table cells, tabs, dropdown items, modal parts, alerts, labels,
 *   badges, pager buttons). Grid, .row, .col-*, .container and .navbar are untouched (the host owns its header).
 *
 * COLOUR MAPPING
 *   .btn-*                                  rest        hover
 *     .btn / .btn-default   FtyButton outline  white (opaque — Bootstrap's own .btn-default is white, and an
 *                                              outline button floated over a map/photo must stay legible),
 *                                              #030213 text, rgba(0,0,0,.1) border → #e9ebef
 *     .btn-primary          FtyButton navy     #0e487e   → #003366   (Orion primary actions are brand blue)
 *     .btn-success          save green         #34a853   → #2b8c45
 *     .btn-info             fitblue-primary    #005a9c   → #004578
 *     .btn-warning          CTA orange         #ff6f00   → #e66400
 *     .btn-danger           FtyButton danger   #d4183d   → opacity .9
 *     .btn-link             link               #005a9c text, no border → #003366
 *   .label-*                FtyBadge severity
 *     .label / .label-default  secondary   (oklch(.95 …) / #030213)
 *     .label-primary           navy        (#0e487e / #fff — matches .btn-primary, not FtyBadge primary)
 *     .label-success           success     (#d1fae5 / #047857)
 *     .label-info              info        (#dbeafe / #1d4ed8)
 *     .label-warning           warning     (#fef3c7 / #b45309)
 *     .label-danger            danger      (#fee2e2 / #b91c1c)
 *   .alert-*, table context rows (.success/.info/.warning/.danger) use the same status palettes.
 *   .panel-primary/-success/-info/-warning/-danger: a 4px left accent in the matching .btn-* colour.
 *
 * PRINT
 *   The @media print block at the end removes the shadows this file adds and drops the select chevron.
 *   Bootstrap's own print block already strips backgrounds and colours.
 */

/* ======================================================================================================
   Buttons — .btn → FtyButton
   ====================================================================================================== */

.btn {
	--fty-btn-bg: var(--fty-bg-surface); /* opaque, as in Bootstrap: a bare .btn often floats over a map or photo */
	--fty-btn-fg: var(--fty-text);
	--fty-btn-border: var(--fty-border);
	--fty-btn-hover-bg: var(--fty-bg-accent);
	--fty-btn-hover-fg: var(--fty-btn-fg);
	--fty-btn-hover-border: var(--fty-btn-border);
	--fty-btn-hover-opacity: 1;
	padding: 6px 16px;
	font-size: var(--fty-font-size);
	font-weight: 500;
	line-height: 22px;
	color: var(--fty-btn-fg);
	background-color: var(--fty-btn-bg);
	border-color: var(--fty-btn-border);
	border-radius: var(--fty-radius-md);
	transition: color var(--fty-transition), background-color var(--fty-transition), border-color var(--fty-transition), box-shadow var(--fty-transition), opacity var(--fty-transition);
}

/* Variants: custom properties only — the state rules below read them. */
.btn-default {
	--fty-btn-bg: var(--fty-bg-surface);
	--fty-btn-fg: var(--fty-text);
	--fty-btn-border: var(--fty-border);
	--fty-btn-hover-bg: var(--fty-bg-accent);
	--fty-btn-hover-border: var(--fty-border);
}

.btn-primary {
	--fty-btn-bg: var(--fty-blue-light);
	--fty-btn-fg: #ffffff;
	--fty-btn-border: var(--fty-blue-light);
	--fty-btn-hover-bg: var(--fty-blue-dark);
	--fty-btn-hover-border: var(--fty-blue-dark);
}

.btn-success {
	--fty-btn-bg: var(--fty-green-save);
	--fty-btn-fg: #ffffff;
	--fty-btn-border: var(--fty-green-save);
	--fty-btn-hover-bg: #2b8c45;
	--fty-btn-hover-border: #2b8c45;
}

.btn-info {
	--fty-btn-bg: var(--fty-blue);
	--fty-btn-fg: #ffffff;
	--fty-btn-border: var(--fty-blue);
	--fty-btn-hover-bg: #004578;
	--fty-btn-hover-border: #004578;
}

.btn-warning {
	--fty-btn-bg: var(--fty-orange);
	--fty-btn-fg: #ffffff;
	--fty-btn-border: var(--fty-orange);
	--fty-btn-hover-bg: var(--fty-orange-hover);
	--fty-btn-hover-border: var(--fty-orange-hover);
}

.btn-danger {
	--fty-btn-bg: var(--fty-destructive);
	--fty-btn-fg: #ffffff;
	--fty-btn-border: var(--fty-destructive);
	--fty-btn-hover-bg: var(--fty-destructive);
	--fty-btn-hover-border: var(--fty-destructive);
	--fty-btn-hover-opacity: 0.9;
}

.btn-link {
	--fty-btn-bg: transparent;
	--fty-btn-fg: var(--fty-link);
	--fty-btn-border: transparent;
	--fty-btn-hover-bg: transparent;
	--fty-btn-hover-fg: var(--fty-link-hover);
	--fty-btn-hover-border: transparent;
}

/* Focus: rest colours plus the Fty focus ring (Bootstrap darkens on focus; Fty does not). */
.btn:focus,
.btn.focus {
	color: var(--fty-btn-fg);
	background-color: var(--fty-btn-bg);
	border-color: var(--fty-btn-border);
}

.btn:focus,
.btn:active:focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn.active.focus {
	outline: 0;
	box-shadow: var(--fty-focus-ring);
}

.btn:focus-visible {
	outline: 2px solid var(--fty-blue);
	outline-offset: 2px;
}

.btn:hover {
	color: var(--fty-btn-hover-fg);
	background-color: var(--fty-btn-hover-bg);
	border-color: var(--fty-btn-hover-border);
	opacity: var(--fty-btn-hover-opacity);
}

/* Pressed / toggled / open dropdown toggle: the hover colours, no inset shadow. */
.btn:active,
.btn.active,
.open > .dropdown-toggle.btn,
.open .dropdown-toggle.btn {
	color: var(--fty-btn-hover-fg);
	background-color: var(--fty-btn-hover-bg);
	border-color: var(--fty-btn-hover-border);
	box-shadow: none;
}

.btn:active:hover,
.btn.active:hover,
.open > .dropdown-toggle.btn:hover,
.btn:active:focus,
.btn.active:focus,
.open > .dropdown-toggle.btn:focus,
.btn:active.focus,
.btn.active.focus,
.open > .dropdown-toggle.btn.focus {
	color: var(--fty-btn-hover-fg);
	background-color: var(--fty-btn-hover-bg);
	border-color: var(--fty-btn-hover-border);
}

.btn-group.open .dropdown-toggle {
	box-shadow: none;
}

/* Disabled: rest colours at opacity .5 in every state (3.1 also lists :active / .active). */
.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn,
.btn.disabled:hover,
.btn[disabled]:hover,
fieldset[disabled] .btn:hover,
.btn.disabled:focus,
.btn[disabled]:focus,
fieldset[disabled] .btn:focus,
.btn.disabled.focus,
.btn[disabled].focus,
fieldset[disabled] .btn.focus,
.btn.disabled:active,
.btn[disabled]:active,
fieldset[disabled] .btn:active,
.btn.disabled.active,
.btn[disabled].active,
fieldset[disabled] .btn.active {
	color: var(--fty-btn-fg);
	background-color: var(--fty-btn-bg);
	border-color: var(--fty-btn-border);
	box-shadow: none;
	opacity: 0.5;
}

/* Sizes (md is the base): sm 32px, lg 40px, xs 24px (kept smaller than sm for dense table rows). */
.btn-lg,
.btn-group-lg > .btn {
	padding: 8px 24px;
	font-size: var(--fty-font-size);
	line-height: 22px;
	border-radius: var(--fty-radius-md);
}

.btn-sm,
.btn-group-sm > .btn {
	padding: 4px 12px;
	font-size: var(--fty-font-size-xs);
	line-height: 22px;
	border-radius: var(--fty-radius-md);
}

.btn-xs,
.btn-group-xs > .btn {
	padding: 1px 8px;
	font-size: var(--fty-font-size-xs);
	line-height: 20px;
	border-radius: var(--fty-radius-sm);
}

/* Button groups: Bootstrap's own rules square the inner corners at higher specificity; only the vertical
   group's outer corners are re-rounded here (Bootstrap sets them to 4px). */
.btn-group-vertical > .btn:first-child:not(:last-child) {
	border-top-left-radius: var(--fty-radius-md);
	border-top-right-radius: var(--fty-radius-md);
}

.btn-group-vertical > .btn:last-child:not(:first-child) {
	border-bottom-left-radius: var(--fty-radius-md);
	border-bottom-right-radius: var(--fty-radius-md);
}

/* Badges inside buttons */
.btn-default .badge,
.btn-link .badge {
	color: var(--fty-text-secondary);
	background-color: var(--fty-bg-hover);
}

.btn-primary .badge,
.btn-success .badge,
.btn-info .badge,
.btn-warning .badge,
.btn-danger .badge {
	color: var(--fty-btn-bg);
	background-color: #ffffff;
}

/* ======================================================================================================
   Forms — .form-control → Fty field
   ====================================================================================================== */

.form-control {
	height: var(--fty-field-height);
	padding: 6px 12px;
	font-size: var(--fty-font-size);
	line-height: 1.5;
	color: var(--fty-text);
	background-color: var(--fty-bg-input);
	border: 1px solid var(--fty-border);
	border-radius: var(--fty-radius-md);
	box-shadow: none;
	transition: border-color var(--fty-transition), box-shadow var(--fty-transition), background-color var(--fty-transition);
}

.form-control:focus {
	background-color: var(--fty-bg-surface);
	border-color: var(--fty-blue);
	outline: 0;
	box-shadow: var(--fty-focus-ring);
}

.form-control::placeholder {
	color: var(--fty-text-muted);
	opacity: 1;
}

.form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control {
	background-color: var(--fty-bg-hover);
	opacity: 1;
}

.form-control[disabled],
fieldset[disabled] .form-control {
	opacity: 0.5;
	cursor: not-allowed;
}

textarea.form-control {
	height: auto;
	padding: 10px 12px;
	line-height: 1.6;
}

/* Single-value select: FtySelect chevron. */
select.form-control {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	padding-right: 32px;
	background-image: var(--fty-icon-chevron);
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 10px 6px;
	cursor: pointer;
}

select.form-control::-ms-expand {
	display: none;
}

select[multiple].form-control,
select[size].form-control {
	height: auto;
	padding-right: 12px;
	background-image: none;
	cursor: default;
}

/* Date/time inputs: Bootstrap sets line-height to the old field height (34px / 30px / 46px). */
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control,
input[type="month"].form-control,
input[type="date"].input-sm,
input[type="time"].input-sm,
input[type="datetime-local"].input-sm,
input[type="month"].input-sm,
.input-group-sm input[type="date"],
.input-group-sm input[type="time"],
.input-group-sm input[type="datetime-local"],
.input-group-sm input[type="month"],
input[type="date"].input-lg,
input[type="time"].input-lg,
input[type="datetime-local"].input-lg,
input[type="month"].input-lg,
.input-group-lg input[type="date"],
.input-group-lg input[type="time"],
.input-group-lg input[type="datetime-local"],
.input-group-lg input[type="month"] {
	line-height: 22px;
}

/* Field sizes */
.input-sm,
.form-group-sm .form-control {
	height: var(--fty-field-height-sm);
	padding: 4px 10px;
	font-size: var(--fty-font-size-sm);
	line-height: 1.5;
	border-radius: var(--fty-radius-sm);
}

select.input-sm,
.form-group-sm select.form-control {
	height: var(--fty-field-height-sm);
	line-height: 1.5;
}

.input-lg,
.form-group-lg .form-control {
	height: var(--fty-field-height-lg);
	padding: 8px 12px;
	font-size: var(--fty-font-size);
	line-height: 1.5;
	border-radius: var(--fty-radius-md);
}

select.input-lg,
.form-group-lg select.form-control {
	height: var(--fty-field-height-lg);
	line-height: 1.5;
}

textarea.input-sm,
select[multiple].input-sm,
.form-group-sm textarea.form-control,
.form-group-sm select[multiple].form-control,
textarea.input-lg,
select[multiple].input-lg,
.form-group-lg textarea.form-control,
.form-group-lg select[multiple].form-control {
	height: auto;
}

textarea.input-sm,
.form-group-sm textarea.form-control {
	padding: 6px 10px;
}

textarea.input-lg,
.form-group-lg textarea.form-control {
	padding: 12px;
}

/* Input groups */
.input-group-addon {
	padding: 6px 12px;
	font-size: var(--fty-font-size);
	color: var(--fty-text-secondary);
	background-color: var(--fty-bg-hover);
	border: 1px solid var(--fty-border);
	border-radius: var(--fty-radius-md);
}

.input-group-addon.input-sm {
	padding: 4px 10px;
	font-size: var(--fty-font-size-sm);
	border-radius: var(--fty-radius-sm);
}

.input-group-addon.input-lg {
	padding: 8px 12px;
	font-size: var(--fty-font-size);
	border-radius: var(--fty-radius-md);
}

.input-group-sm > .form-control,
.input-group-sm > .input-group-addon,
.input-group-sm > .input-group-btn > .btn {
	height: var(--fty-field-height-sm);
	padding: 4px 10px;
	font-size: var(--fty-font-size-sm);
	line-height: 1.5;
	border-radius: var(--fty-radius-sm);
}

.input-group-lg > .form-control,
.input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .btn {
	height: var(--fty-field-height-lg);
	padding: 8px 12px;
	font-size: var(--fty-font-size);
	line-height: 1.5;
	border-radius: var(--fty-radius-md);
}

/* Joined corners: Bootstrap's own rules, repeated here because the size rules above (same specificity,
   later) would otherwise round the inner corners again. */
.input-group .form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .btn-group > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

.input-group .form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .btn-group > .btn,
.input-group-btn:last-child > .dropdown-toggle,
.input-group-btn:first-child > .btn:not(:first-child),
.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

.input-group .form-control:not(:first-child):not(:last-child),
.input-group-addon:not(:first-child):not(:last-child),
.input-group-btn:not(:first-child):not(:last-child) > .btn {
	border-radius: 0;
}

/* Labels (FieldLabel) and help text. Margins stay as Bootstrap sets them. */
.control-label,
.form-group > label {
	font-size: var(--fty-font-size);
	font-weight: 500;
	color: var(--fty-text-label);
}

.help-block {
	font-size: var(--fty-font-size-sm);
	color: var(--fty-text-muted);
}

/* Validation states */
.has-error .help-block,
.has-error .control-label,
.has-error .radio,
.has-error .checkbox,
.has-error .radio-inline,
.has-error .checkbox-inline,
.has-error.radio label,
.has-error.checkbox label,
.has-error.radio-inline label,
.has-error.checkbox-inline label,
.has-error > label,
.has-error .form-control-feedback {
	color: var(--fty-destructive);
}

.has-error .form-control {
	border-color: var(--fty-destructive);
	box-shadow: none;
}

.has-error .form-control:focus {
	border-color: var(--fty-destructive);
	box-shadow: 0 0 0 3px rgba(212, 24, 61, 0.1);
}

.has-error .input-group-addon {
	color: var(--fty-destructive);
	background-color: var(--fty-danger-bg);
	border-color: var(--fty-destructive);
}

.has-success .help-block,
.has-success .control-label,
.has-success .radio,
.has-success .checkbox,
.has-success .radio-inline,
.has-success .checkbox-inline,
.has-success.radio label,
.has-success.checkbox label,
.has-success.radio-inline label,
.has-success.checkbox-inline label,
.has-success > label,
.has-success .form-control-feedback {
	color: var(--fty-success-fg);
}

.has-success .form-control {
	border-color: var(--fty-success-fg);
	box-shadow: none;
}

.has-success .form-control:focus {
	border-color: var(--fty-success-fg);
	box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.1);
}

.has-success .input-group-addon {
	color: var(--fty-success-fg);
	background-color: var(--fty-success-bg);
	border-color: var(--fty-success-fg);
}

.has-warning .help-block,
.has-warning .control-label,
.has-warning .radio,
.has-warning .checkbox,
.has-warning .radio-inline,
.has-warning .checkbox-inline,
.has-warning.radio label,
.has-warning.checkbox label,
.has-warning.radio-inline label,
.has-warning.checkbox-inline label,
.has-warning > label,
.has-warning .form-control-feedback {
	color: var(--fty-warning-fg);
}

.has-warning .form-control {
	border-color: var(--fty-warning-fg);
	box-shadow: none;
}

.has-warning .form-control:focus {
	border-color: var(--fty-warning-fg);
	box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.1);
}

.has-warning .input-group-addon {
	color: var(--fty-warning-fg);
	background-color: var(--fty-warning-bg);
	border-color: var(--fty-warning-fg);
}

/* jquery.validate.unobtrusive (ASP.NET MVC) */
.input-validation-error,
.form-control.input-validation-error {
	border-color: var(--fty-destructive);
}

.input-validation-error:focus,
.form-control.input-validation-error:focus {
	border-color: var(--fty-destructive);
	box-shadow: 0 0 0 3px rgba(212, 24, 61, 0.1);
}

.field-validation-error {
	font-size: var(--fty-font-size-xs);
	color: var(--fty-destructive);
}

.validation-summary-errors {
	box-sizing: border-box;
	margin-bottom: 16px;
	padding: 12px 16px;
	font-size: var(--fty-font-size);
	line-height: 1.5;
	color: var(--fty-danger-fg);
	background-color: var(--fty-danger-bg);
	border: 1px solid var(--fty-danger-border);
	border-radius: var(--fty-radius-md);
}

.validation-summary-errors ul {
	margin: 0;
	padding-left: 20px;
}

/* ======================================================================================================
   Tables — .table → FtyDataGrid
   ====================================================================================================== */

.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
	padding: 12px;
	border-top-color: var(--fty-border-subtle);
}

.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
	font-size: var(--fty-font-size);
	color: var(--fty-text);
}

/* Header cells. `tbody:first-child > tr:first-child > th` covers tables with no <thead> (the MVC scaffold). */
.table > thead > tr > th,
.table > tbody:first-child > tr:first-child > th {
	font-size: var(--fty-font-size-xs);
	font-weight: 700;
	line-height: 16px;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	color: var(--fty-text-secondary);
	background-color: var(--fty-bg-th);
}

.table > thead > tr > th {
	border-bottom: 1px solid var(--fty-border-subtle);
}

.table > tbody + tbody {
	border-top-color: var(--fty-border-subtle);
}

.table-condensed > thead > tr > th,
.table-condensed > tbody > tr > th,
.table-condensed > tfoot > tr > th,
.table-condensed > thead > tr > td,
.table-condensed > tbody > tr > td,
.table-condensed > tfoot > tr > td {
	padding: 8px;
}

.table-bordered,
.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > th,
.table-bordered > tfoot > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > td {
	border-color: var(--fty-border-subtle);
}

.table-bordered > thead > tr > th,
.table-bordered > thead > tr > td {
	border-bottom-width: 1px;
}

/* Stripes and hover: 3.3 paints the row, 3.1 paints the cells — both shapes. */
.table-striped > tbody > tr:nth-of-type(odd),
.table-striped > tbody > tr:nth-child(odd) > td,
.table-striped > tbody > tr:nth-child(odd) > th {
	background-color: #fafbfc;
}

.table-hover > tbody > tr:hover,
.table-hover > tbody > tr:hover > td,
.table-hover > tbody > tr:hover > th {
	background-color: var(--fty-bg-row-hover);
}

/* Contextual rows/cells: FtyBadge pastel backgrounds (after stripes and hover, which share their specificity). */
.table > thead > tr > td.active,
.table > tbody > tr > td.active,
.table > tfoot > tr > td.active,
.table > thead > tr > th.active,
.table > tbody > tr > th.active,
.table > tfoot > tr > th.active,
.table > thead > tr.active > td,
.table > tbody > tr.active > td,
.table > tfoot > tr.active > td,
.table > thead > tr.active > th,
.table > tbody > tr.active > th,
.table > tfoot > tr.active > th {
	background-color: var(--fty-bg-hover);
}

.table-hover > tbody > tr > td.active:hover,
.table-hover > tbody > tr > th.active:hover,
.table-hover > tbody > tr.active:hover > td,
.table-hover > tbody > tr:hover > .active,
.table-hover > tbody > tr.active:hover > th {
	background-color: var(--fty-bg-skeleton);
}

.table > thead > tr > td.success,
.table > tbody > tr > td.success,
.table > tfoot > tr > td.success,
.table > thead > tr > th.success,
.table > tbody > tr > th.success,
.table > tfoot > tr > th.success,
.table > thead > tr.success > td,
.table > tbody > tr.success > td,
.table > tfoot > tr.success > td,
.table > thead > tr.success > th,
.table > tbody > tr.success > th,
.table > tfoot > tr.success > th {
	background-color: var(--fty-success-bg);
}

.table-hover > tbody > tr > td.success:hover,
.table-hover > tbody > tr > th.success:hover,
.table-hover > tbody > tr.success:hover > td,
.table-hover > tbody > tr:hover > .success,
.table-hover > tbody > tr.success:hover > th {
	background-color: var(--fty-success-border);
}

.table > thead > tr > td.info,
.table > tbody > tr > td.info,
.table > tfoot > tr > td.info,
.table > thead > tr > th.info,
.table > tbody > tr > th.info,
.table > tfoot > tr > th.info,
.table > thead > tr.info > td,
.table > tbody > tr.info > td,
.table > tfoot > tr.info > td,
.table > thead > tr.info > th,
.table > tbody > tr.info > th,
.table > tfoot > tr.info > th {
	background-color: var(--fty-info-bg);
}

.table-hover > tbody > tr > td.info:hover,
.table-hover > tbody > tr > th.info:hover,
.table-hover > tbody > tr.info:hover > td,
.table-hover > tbody > tr:hover > .info,
.table-hover > tbody > tr.info:hover > th {
	background-color: var(--fty-info-border);
}

.table > thead > tr > td.warning,
.table > tbody > tr > td.warning,
.table > tfoot > tr > td.warning,
.table > thead > tr > th.warning,
.table > tbody > tr > th.warning,
.table > tfoot > tr > th.warning,
.table > thead > tr.warning > td,
.table > tbody > tr.warning > td,
.table > tfoot > tr.warning > td,
.table > thead > tr.warning > th,
.table > tbody > tr.warning > th,
.table > tfoot > tr.warning > th {
	background-color: var(--fty-warning-bg);
}

.table-hover > tbody > tr > td.warning:hover,
.table-hover > tbody > tr > th.warning:hover,
.table-hover > tbody > tr.warning:hover > td,
.table-hover > tbody > tr:hover > .warning,
.table-hover > tbody > tr.warning:hover > th {
	background-color: var(--fty-warning-border);
}

.table > thead > tr > td.danger,
.table > tbody > tr > td.danger,
.table > tfoot > tr > td.danger,
.table > thead > tr > th.danger,
.table > tbody > tr > th.danger,
.table > tfoot > tr > th.danger,
.table > thead > tr.danger > td,
.table > tbody > tr.danger > td,
.table > tfoot > tr.danger > td,
.table > thead > tr.danger > th,
.table > tbody > tr.danger > th,
.table > tfoot > tr.danger > th {
	background-color: var(--fty-danger-bg);
}

.table-hover > tbody > tr > td.danger:hover,
.table-hover > tbody > tr > th.danger:hover,
.table-hover > tbody > tr.danger:hover > td,
.table-hover > tbody > tr:hover > .danger,
.table-hover > tbody > tr.danger:hover > th {
	background-color: var(--fty-danger-border);
}

/* ======================================================================================================
   Navs — .nav-tabs → TabBar, .nav-pills, .breadcrumb
   ====================================================================================================== */

.nav-tabs {
	border-bottom-color: var(--fty-border-gray);
}

.nav-tabs > li > a {
	margin-right: 0;
	padding: 12px 16px;
	font-size: var(--fty-font-size);
	font-weight: 500;
	line-height: 20px;
	color: var(--fty-text-secondary);
	background-color: transparent;
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: 0;
	transition: color var(--fty-transition), border-color var(--fty-transition);
}

.nav-tabs > li > a:hover,
.nav-tabs > li > a:focus {
	color: var(--fty-text-body);
	background-color: transparent;
	border-bottom-color: var(--fty-border-hover);
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
	color: var(--fty-heading);
	background-color: transparent;
	border: 0;
	border-bottom: 2px solid var(--fty-heading);
}

.nav-tabs > li.disabled > a,
.nav-tabs > li.disabled > a:hover,
.nav-tabs > li.disabled > a:focus {
	color: var(--fty-text-secondary);
	border-bottom-color: transparent;
	opacity: 0.5;
}

.nav-tabs .open > a,
.nav-tabs .open > a:hover,
.nav-tabs .open > a:focus {
	background-color: transparent;
	border-color: transparent transparent var(--fty-border-hover);
}

.nav-tabs.nav-justified > li > a {
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: 0;
}

.nav-tabs.nav-justified > .active > a,
.nav-tabs.nav-justified > .active > a:hover,
.nav-tabs.nav-justified > .active > a:focus {
	border: 0;
	border-bottom: 2px solid var(--fty-heading);
}

.nav-pills > li > a {
	font-weight: 500;
	color: var(--fty-text-body);
	border-radius: var(--fty-radius-md);
}

.nav-pills > li > a:hover,
.nav-pills > li > a:focus {
	color: var(--fty-text-body);
	background-color: var(--fty-bg-hover);
}

.nav-pills > li.active > a,
.nav-pills > li.active > a:hover,
.nav-pills > li.active > a:focus {
	color: #ffffff;
	background-color: var(--fty-blue-light);
}

.nav-pills > .active > a > .badge,
.list-group-item.active > .badge {
	color: var(--fty-blue-light);
	background-color: #ffffff;
}

.breadcrumb {
	font-size: var(--fty-font-size-sm);
	color: var(--fty-text-muted);
	background-color: transparent;
	border-radius: 0;
}

.breadcrumb > li + li:before {
	color: var(--fty-border-hover);
}

.breadcrumb > li > a {
	color: var(--fty-link);
}

.breadcrumb > li > a:hover,
.breadcrumb > li > a:focus {
	color: var(--fty-link-hover);
}

.breadcrumb > .active {
	font-weight: 500;
	color: var(--fty-text-body);
}

/* ======================================================================================================
   Dropdowns — .dropdown-menu → Fty panel + options
   ====================================================================================================== */

.dropdown-menu {
	padding: 4px;
	font-size: var(--fty-font-size);
	border: 1px solid var(--fty-border-subtle);
	border-radius: var(--fty-radius-md);
	box-shadow: var(--fty-shadow-panel);
}

.dropdown-menu > li > a {
	padding: 8px 12px;
	line-height: 1.5;
	color: var(--fty-text);
	border-radius: var(--fty-radius-sm);
	transition: background-color 0.1s;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
	color: var(--fty-text);
	background-color: var(--fty-bg-hover);
}

.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
	font-weight: 600;
	color: var(--fty-blue);
	background-color: var(--fty-bg-selected);
}

.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
	background-color: var(--fty-bg-selected-hover);
}

.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
	color: var(--fty-text-muted);
	background-color: transparent;
	opacity: 0.5;
}

.dropdown-menu .divider {
	margin: 4px 0;
	background-color: var(--fty-border-gray);
}

.dropdown-header {
	padding: 8px 12px 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: #9ca3af;
}

/* Navbar dropdowns get the panel look too (Bootstrap squares the corners that touch the bar). */
.navbar-nav > li > .dropdown-menu {
	border-top-left-radius: var(--fty-radius-md);
	border-top-right-radius: var(--fty-radius-md);
}

.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {
	border-bottom-left-radius: var(--fty-radius-md);
	border-bottom-right-radius: var(--fty-radius-md);
}

/* ======================================================================================================
   Modals — .modal-content → FtyDialog
   ====================================================================================================== */

.modal-content {
	border: 0;
	border-radius: var(--fty-radius-lg);
	box-shadow: var(--fty-shadow-dialog);
}

.modal-header {
	padding: 16px 20px;
	border-bottom-color: var(--fty-border-gray);
}

.modal-title {
	font-size: 18px;
	font-weight: 600;
	line-height: 28px;
	color: var(--fty-heading);
}

.modal-body {
	padding: 20px;
}

.modal-footer {
	margin-top: 0;
	padding: 16px 20px;
	border-top-color: var(--fty-border-gray);
}

/* Bootstrap fades the backdrop to opacity .5 over #000; paint the Fty overlay at full opacity instead. */
.modal-backdrop {
	background-color: var(--fty-overlay);
}

.modal-backdrop.in {
	opacity: 1;
}

.close {
	font-size: 20px;
	font-weight: 400;
	color: var(--fty-text-muted);
	text-shadow: none;
	opacity: 1;
}

.close:hover,
.close:focus {
	color: var(--fty-text);
	opacity: 1;
}

/* ======================================================================================================
   Alerts — .alert → .fty-c-alert palettes
   ====================================================================================================== */

.alert {
	padding: 12px 16px;
	font-size: var(--fty-font-size);
	line-height: 1.5;
	border-radius: var(--fty-radius-md);
}

.alert-dismissable,
.alert-dismissible {
	padding-right: 36px;
}

.alert-success {
	color: var(--fty-success-fg);
	background-color: var(--fty-success-bg);
	border-color: var(--fty-success-border);
}

.alert-info {
	color: var(--fty-info-fg);
	background-color: var(--fty-info-bg);
	border-color: var(--fty-info-border);
}

.alert-warning {
	color: var(--fty-warning-fg);
	background-color: var(--fty-warning-bg);
	border-color: var(--fty-warning-border);
}

.alert-danger {
	color: var(--fty-danger-fg);
	background-color: var(--fty-danger-bg);
	border-color: var(--fty-danger-border);
}

.alert .alert-link {
	font-weight: 600;
	color: inherit;
	text-decoration: underline;
}

/* ======================================================================================================
   Labels and badges — .label → FtyBadge, .badge → CountBadge
   ====================================================================================================== */

.label {
	--fty-label-bg: var(--fty-secondary);
	--fty-label-fg: var(--fty-secondary-fg);
	padding: 2px 8px;
	font-size: var(--fty-font-size-xs);
	font-weight: 600;
	line-height: 16px;
	color: var(--fty-label-fg);
	background-color: var(--fty-label-bg);
	border-radius: var(--fty-radius-sm);
}

a.label:hover,
a.label:focus {
	color: var(--fty-label-fg);
}

.label-default {
	--fty-label-bg: var(--fty-secondary);
	--fty-label-fg: var(--fty-secondary-fg);
}

.label-primary {
	--fty-label-bg: var(--fty-blue-light);
	--fty-label-fg: #ffffff;
}

.label-success {
	--fty-label-bg: var(--fty-success-bg);
	--fty-label-fg: var(--fty-success-fg);
}

.label-info {
	--fty-label-bg: var(--fty-info-bg);
	--fty-label-fg: var(--fty-info-fg);
}

.label-warning {
	--fty-label-bg: var(--fty-warning-bg);
	--fty-label-fg: var(--fty-warning-fg);
}

.label-danger {
	--fty-label-bg: var(--fty-danger-bg);
	--fty-label-fg: var(--fty-danger-fg);
}

/* Bootstrap darkens linked labels on hover per variant; keep the badge colours. */
.label-default[href]:hover,
.label-default[href]:focus,
.label-primary[href]:hover,
.label-primary[href]:focus,
.label-success[href]:hover,
.label-success[href]:focus,
.label-info[href]:hover,
.label-info[href]:focus,
.label-warning[href]:hover,
.label-warning[href]:focus,
.label-danger[href]:hover,
.label-danger[href]:focus {
	background-color: var(--fty-label-bg);
}

.badge {
	padding: 2px 8px;
	font-size: var(--fty-font-size-xs);
	font-weight: 600;
	line-height: 16px;
	color: var(--fty-text-secondary);
	background-color: var(--fty-bg-hover);
	border-radius: var(--fty-radius-pill);
}

a.badge:hover,
a.badge:focus {
	color: var(--fty-text-body);
}

/* ======================================================================================================
   Panels and wells — .panel → FtyCard (radius 12: legacy panels are dense), .well → muted card
   ====================================================================================================== */

.panel {
	border-color: var(--fty-border-card);
	border-radius: var(--fty-radius-lg);
	box-shadow: var(--fty-shadow-sm);
}

.panel-heading {
	border-top-left-radius: calc(var(--fty-radius-lg) - 1px);
	border-top-right-radius: calc(var(--fty-radius-lg) - 1px);
}

.panel > .panel-heading {
	color: var(--fty-heading);
	background-color: var(--fty-bg-surface);
	border-bottom-color: var(--fty-border-card);
}

.panel-title {
	font-size: 16px;
	font-weight: 600;
	color: var(--fty-heading);
}

.panel-footer {
	background-color: var(--fty-bg-surface);
	border-top-color: var(--fty-border-card);
	border-bottom-right-radius: calc(var(--fty-radius-lg) - 1px);
	border-bottom-left-radius: calc(var(--fty-radius-lg) - 1px);
}

.panel > .panel-heading + .panel-collapse > .panel-body,
.panel-group .panel-heading + .panel-collapse > .panel-body,
.panel-group .panel-heading + .panel-collapse > .list-group {
	border-top-color: var(--fty-border-card);
}

.panel > .panel-footer + .panel-collapse > .panel-body,
.panel-group .panel-footer + .panel-collapse .panel-body {
	border-bottom-color: var(--fty-border-card);
}

.panel > .panel-heading .badge {
	color: var(--fty-text-secondary);
	background-color: var(--fty-bg-hover);
}

.panel-group .panel {
	border-radius: var(--fty-radius-lg);
}

.panel > .panel-body + .table,
.panel > .panel-body + .table-responsive,
.panel > .table + .panel-body,
.panel > .table-responsive + .panel-body {
	border-top-color: var(--fty-border-subtle);
}

/* Tables flush with a panel edge: round the corner cells to the panel radius (Bootstrap uses 3px). */
.panel > .table:first-child > thead:first-child > tr:first-child td:first-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child,
.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child,
.panel > .table:first-child > thead:first-child > tr:first-child th:first-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child,
.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child {
	border-top-left-radius: calc(var(--fty-radius-lg) - 1px);
}

.panel > .table:first-child > thead:first-child > tr:first-child td:last-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child,
.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child,
.panel > .table:first-child > thead:first-child > tr:first-child th:last-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child,
.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child {
	border-top-right-radius: calc(var(--fty-radius-lg) - 1px);
}

.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child {
	border-bottom-left-radius: calc(var(--fty-radius-lg) - 1px);
}

.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child {
	border-bottom-right-radius: calc(var(--fty-radius-lg) - 1px);
}

/* Contextual panels: neutral header, 4px left accent (AccentCard) instead of a coloured header. */
.panel-primary {
	--fty-accent: var(--fty-blue-light);
}

.panel-success {
	--fty-accent: var(--fty-green-save);
}

.panel-info {
	--fty-accent: var(--fty-blue);
}

.panel-warning {
	--fty-accent: var(--fty-orange);
}

.panel-danger {
	--fty-accent: var(--fty-destructive);
}

.panel-primary,
.panel-success,
.panel-info,
.panel-warning,
.panel-danger {
	border-left: 4px solid var(--fty-accent, var(--fty-blue));
}

.well {
	background-color: var(--fty-bg-row-hover);
	border: 1px solid var(--fty-border-subtle);
	border-radius: var(--fty-radius-md);
	box-shadow: none;
}

.well-lg {
	border-radius: var(--fty-radius-lg);
}

.well-sm {
	border-radius: var(--fty-radius-sm);
}

/* ======================================================================================================
   Pagination — .pagination → FtyTablePager buttons
   ====================================================================================================== */

.pagination > li > a,
.pagination > li > span {
	min-width: 32px;
	margin-left: 4px;
	padding: 0 8px;
	font-size: var(--fty-font-size-sm);
	font-weight: 500;
	line-height: 30px;
	text-align: center;
	color: var(--fty-text-secondary);
	background-color: transparent;
	border-color: transparent;
	border-radius: var(--fty-radius-md);
	transition: background-color var(--fty-transition), color var(--fty-transition);
}

.pagination > li:first-child > a,
.pagination > li:first-child > span {
	margin-left: 0;
	border-radius: var(--fty-radius-md);
}

.pagination > li:last-child > a,
.pagination > li:last-child > span {
	border-radius: var(--fty-radius-md);
}

.pagination > li > a:hover,
.pagination > li > span:hover,
.pagination > li > a:focus,
.pagination > li > span:focus {
	color: var(--fty-text-secondary);
	background-color: var(--fty-bg-hover);
	border-color: transparent;
}

.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
	color: #ffffff;
	background-color: var(--fty-blue-light);
	border-color: var(--fty-blue-light);
}

.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
	background-color: var(--fty-blue-dark);
	border-color: var(--fty-blue-dark);
}

.pagination > .disabled > span,
.pagination > .disabled > span:hover,
.pagination > .disabled > span:focus,
.pagination > .disabled > a,
.pagination > .disabled > a:hover,
.pagination > .disabled > a:focus {
	color: var(--fty-text-secondary);
	background-color: transparent;
	border-color: transparent;
	opacity: 0.4;
}

.pagination-lg > li > a,
.pagination-lg > li > span {
	min-width: 40px;
	padding: 0 12px;
	font-size: var(--fty-font-size);
	line-height: 38px;
}

.pagination-lg > li:first-child > a,
.pagination-lg > li:first-child > span,
.pagination-lg > li:last-child > a,
.pagination-lg > li:last-child > span {
	border-radius: var(--fty-radius-md);
}

.pagination-sm > li > a,
.pagination-sm > li > span {
	min-width: 28px;
	padding: 0 6px;
	font-size: var(--fty-font-size-xs);
	line-height: 26px;
}

.pagination-sm > li:first-child > a,
.pagination-sm > li:first-child > span,
.pagination-sm > li:last-child > a,
.pagination-sm > li:last-child > span {
	border-radius: var(--fty-radius-sm);
}

/* ======================================================================================================
   Progress, tooltips, popovers
   ====================================================================================================== */

.progress {
	background-color: var(--fty-bg-hover);
	border-radius: var(--fty-radius-md);
	box-shadow: none;
}

.progress-bar {
	background-color: var(--fty-blue);
}

.progress-bar-success {
	background-color: var(--fty-green-save);
}

.progress-bar-info {
	background-color: var(--fty-blue);
}

.progress-bar-warning {
	background-color: var(--fty-orange);
}

.progress-bar-danger {
	background-color: var(--fty-destructive);
}

.tooltip.in {
	opacity: 1;
}

.tooltip-inner {
	padding: 4px 8px;
	font-size: var(--fty-font-size-xs);
	color: #ffffff;
	background-color: #1e293b;
	border-radius: var(--fty-radius-sm);
}

.tooltip.top .tooltip-arrow,
.tooltip.top-left .tooltip-arrow,
.tooltip.top-right .tooltip-arrow {
	border-top-color: #1e293b;
}

.tooltip.right .tooltip-arrow {
	border-right-color: #1e293b;
}

.tooltip.left .tooltip-arrow {
	border-left-color: #1e293b;
}

.tooltip.bottom .tooltip-arrow,
.tooltip.bottom-left .tooltip-arrow,
.tooltip.bottom-right .tooltip-arrow {
	border-bottom-color: #1e293b;
}

.popover {
	color: var(--fty-text);
	border: 1px solid var(--fty-border-subtle);
	border-radius: var(--fty-radius-md);
	box-shadow: var(--fty-shadow-panel);
}

.popover-title {
	font-size: var(--fty-font-size);
	font-weight: 600;
	color: var(--fty-heading);
	background-color: var(--fty-bg-surface);
	border-bottom-color: var(--fty-border-gray);
	border-radius: calc(var(--fty-radius-md) - 1px) calc(var(--fty-radius-md) - 1px) 0 0;
}

/* Outer arrow = the border colour (3.1 writes `.popover.top .arrow`, 3.3 `.popover.top > .arrow`; the
   descendant form matches both at the same specificity). */
.popover.top .arrow {
	border-top-color: var(--fty-border-subtle);
}

.popover.right .arrow {
	border-right-color: var(--fty-border-subtle);
}

.popover.bottom .arrow {
	border-bottom-color: var(--fty-border-subtle);
}

.popover.left .arrow {
	border-left-color: var(--fty-border-subtle);
}

/* ======================================================================================================
   Print — no shadows, no chevron image, outlined buttons (Bootstrap's print block strips colours too).
   ====================================================================================================== */

@media print {
	.btn {
		--fty-btn-bg: transparent;
		--fty-btn-hover-bg: transparent;
		--fty-btn-fg: var(--fty-text);
		--fty-btn-hover-fg: var(--fty-text);
		--fty-btn-border: var(--fty-border-check);
		--fty-btn-hover-border: var(--fty-border-check);
	}

	.btn,
	.btn:focus,
	.btn.focus,
	.form-control,
	.form-control:focus,
	.dropdown-menu,
	.modal-content,
	.panel,
	.popover,
	.well {
		box-shadow: none;
	}

	select.form-control {
		background-image: none;
	}

	.modal-backdrop {
		background-color: transparent;
	}
}
