/**
 *
 * Provide custom layout and form element styles ONLY for elements inside the .forms class.
 * And colorizes elements with a light and dark style.
 * Add 'light' or 'dark' attributes to the <html> tag.
 * It's recommended to use javascript to set this attribute from prefers-color-scheme on page load.
 * TODO: Remove .form-row
 * TODO: Support more elements from https://preview.tabler.io/form-elements.html
 * TODO: consistent naming for grouped and group-left ?
 * TODO: Need more consistent borders and outlines.
 * Then we add a font-size variable and textarea can have a padding top that's:  (input-height - font-size) / 2

 * Possible names besides forms.css:
 * FlexFlow, RolCol, FlexFusion.css, Energy.css, FlexCraft, FlexMatrix.  FlexWarp.  Glide.css
 * DivCrafter - like SiteCrafter.
 * Rex.css - taking a bite out of bad layouts.
 * Rectangles.css - Because your whole UI is made of rectangles.
 */


/* ┌─────────────────╮
 * |Variables        |
 * └─────────────────╯*/
:root {

	/* Dimensions */
	--micro: .125rem;
	--tiny: .25rem;
	--small: .5rem;
	--normal: 1rem;
	--big: 1.5rem;
	--huge: 3rem;

	--input-small: 18px;
	--input-normal: 24px;
	--input-big: 32px;
	--input-huge: 44px;

	--border-width: 1px;
	--border-radius: 3px;

	/* Generic */

	/* Buttons */
	--primary-background: var(--primary);
	--primary-border: var(--border-width) solid var(--primary);

	--primary-background-hover: var(--primary2);
	--primary-border-hover: var(--border-width) solid var(--primary2);

	--secondary-background: var(--secondary);
	--secondary-border: var(--border-width) solid var(--secondary);
}

:root, :root[light] {
	/* Palette */
	--text: #333;
	--background: white;
	--invert: black;

	--shade1: #e4e8ed;
	--shade2: #cbcfd7;
	--shade3: #c0c6cf; /* Unused? */
	--shade4: #aeb3be;

	--primary: #07c;
	--primary2: #08e;

	--invalid: #900;
	--shadow: 0 0 3px #0004;

	/* Elements */
	--primary-text: white;
	--primary-border-focus: black;
	--secondary: var(--shade2);
	--secondary-background-hover: var(--shade4);
	--secondary-border-hover: var(--shade4);
	--input-background: white;
	--input-border: var(--shade2);

	--card-background: white;
	--card-border: none;

	--border: var(--border-width) solid var(--shade2);
	--border-focus: var(--border-width) solid var(--primary2);

	/* Table */
	--table-header-background: var(--shade1);
	--table-border: var(--shade1);
	--table-background: white;
}

:root[dark] {
	/* Palette */
	--text: #bcc3c8;
	--background: black;
	--invert: white;

	--shade1: #06090c;
	--shade2: #0f1318;
	--shade3: #2a3239;
	--shade4: #3d474f;

	--primary: #048;
	--primary2: #05a;
	--invalid: #900;
	--shadow: 0 0 12px #000f;

	/** Elements */
	--primary-text: white;
	--primary-border-focus: white;
	--secondary: var(--shade3);
	--secondary-background-hover: var(--shade4);
	--secondary-border-hover: var(--shade4);
	--input-background: var(--shade1);
	--input-border: var(--shade3);

	--card-background: var(--shade2);
	--card-border: var(--border);

	--border: var(--border-width) solid var(--shade3);
	--border-focus: var(--border-width) solid var(--primary2);

	/* Table */
	--table-header-background:var(--shade3);
	--table-border: var(--shade3);
	--table-background: var(--shade2);
}

/* ┌─────────────────╮
 * |Normalize        |
 * └─────────────────╯*/

.forms :is(button, input, optgroup, select, textarea) { font-family: inherit; font-size: 100% }

/**
 * Prevent `sub` and `sup` elements from affecting the line height in all browsers. */
.forms sub, sup { font-size: 75%; line-height: 0; position: relative }
.forms sub { bottom: -0.25em }
.forms sup { top: -0.5em}

.forms dialog { z-index: 1000 }
.forms dialog::backdrop { background: #0008 }

/* ┌─────────────────╮
 * |Misc             |
 * └─────────────────╯*/

/* Scrollbars */
:is(:root[dark].forms, :root[dark] .forms) { /*noinspection CssInvalidPropertyValue*/scrollbar-color: dark }
:is(:root[dark].forms, :root[dark] .forms) ::-webkit-scrollbar { background: transparent; width: 12px; height: 12px }
:is(:root[dark].forms, :root[dark] .forms) ::-webkit-scrollbar-track,
:is(:root[dark].forms, :root[dark] .forms) ::-webkit-scrollbar-corner { background: transparent }
:is(:root[dark].forms, :root[dark] .forms) ::-webkit-scrollbar-thumb { background: var(--shade3); border-radius: var(--border-radius) }

/* Form validation. Hide fields used by validate.js */
.forms :is(.invalid) { border-color: var(--invalid) !important; outline-color: var(--invalid) !important }
.forms :is(
	[data-pattern], [data-min], [data-max], [data-minlength], [data-maxlength], [data-required], [data-step], [data-type],
	[data-validate]:not(input, .input, select, .select, textarea), [data-validate2], [data-validate3], [data-validate4]) {
	color: var(--invalid); display: none
}

/* Misc */
.forms :is(small, :is(a,b,i,s,p,u,span,div,ul,ol,li,.label):not([contenteditable]).small) { font-size: 75%; opacity: .65; line-height: 1.1 }
.forms .warning { color: var(--invalid) }
.forms a:focus-visible { outline: var(--border-focus) }
.forms :focus-visible { outline: none } /* Remove browser's default outline */
.forms hr { border: none; border-bottom: var(--border) }

	/* Placeholder + Contenteditable placeholder */
.forms ::placeholder { color: inherit; opacity: .6 }
.forms [placeholder]:empty:before { content: attr(placeholder); opacity: .6; white-space: nowrap; cursor: text }
.forms [placeholder]:empty:is(:focus,.focus):before { content: '' }

/* menu-item */
/* A combination of:  class="row pad-h-small pad-v-tiny gap-small btn primary flat center-v" */
.forms .menu-item { display: flex; align-items: center; padding: var(--tiny) var(--small); gap: var(--small); color: var(--text);
	user-select: none; cursor: pointer;
}
.forms .menu-item:hover { background: var(--primary-background); color: var(--primary-text) }

/* Card
 * Must appear before row/col so those can override the display to be flex. */
.forms .card { box-sizing: border-box; background: var(--card-background); box-shadow: var(--shadow) }
.forms .card:not(.square) { border-radius: var(--border-radius) }
.forms .card:not(.flat) { border: var(--card-border) }


/* ┌─────────────────╮
 * |Input+Btn Height |
 * └─────────────────╯*/
/* Height */
.forms :is(
	input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range]),
	.input:not([contenteditable]), select, button, .btn) {
	box-sizing: border-box; padding-top: 0; padding-bottom: 0;
	min-height: var(--input-normal)
}

.forms :is(textarea, [contenteditable].input) {
	box-sizing: border-box;
	min-height: var(--input-normal);
	padding-top: calc((var(--input-normal) - 1lh) / 2) /* Make text line up vertically with inputs.  Top half of the diff between input height and text height*/
}

/* ┌─────────────────╮
 * |Input            |
 * └─────────────────╯*/
.forms :is(.input, select, textarea,
	input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit])) {
	min-width: 0; color: var(--text)
}
.forms :is(.input, select, textarea,
	input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit])):not(.square, .flat) {
	border-radius: var(--border-radius)
}

.forms :is(.input, select, textarea,
	input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit])
):not(.naked, .flat), .input-like {
	background: var(--input-background);
	border: var(--border-width) solid var(--input-border); vertical-align: top; padding-left: var(--tiny); padding-right: var(--tiny);
}

/* Input focus */
.forms :is(
	input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit]),
	.input, select, textarea):not(.flat):is(:focus-within,.focus) {
	outline: var(--border-focus); outline-offset: -1px; z-index: 2 /* z-index lets it the border be on top when inside .grouped */
}
.forms input[type=file]:is(:focus-within, .focus) { outline: var(--border-focus) } /* Can't style file, but at least make the focus look similar. */

/* ┌─────────────────╮
 * |Buttons          |
 * └─────────────────╯*/
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])) {
	box-sizing: border-box; user-select: none; text-align: center; color: var(--text); display: inline-flex; align-items: center }
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])):not([disabled]) {
	cursor: pointer }
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])):not(.square, .flat) {
	border-radius: var(--border-radius) }
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])):not(.flat) {
	padding-left: var(--normal); padding-right: var(--normal); line-height: normal;
	border: var(--secondary-border); background: var(--secondary-background) }

/* Button Hover/Focus */
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])):is(:hover,.hover,.selected):not([disabled],.flat) {
	background: var(--secondary-background-hover); border: var(--border-width) solid var(--secondary-border-hover);
	color: var(--invert)}
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])):is(:focus-visible,.focus) { outline: var(--border-focus); outline-offset: -1px; z-index: 2 }
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])):is([disabled]) { cursor: default; opacity: .5 }

/* Button Primary */
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])).primary:not(.flat) { background: var(--primary-background); border: var(--primary-border) }
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])).primary:not(.naked, .flat) { color: var(--primary-text) }
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])).primary:is(:active,:hover,.active,.hover,.selected):not([disabled]) {
	background: var(--primary-background-hover); border: var(--primary-border-hover); color: var(--primary-text) }
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])).primary:is(:focus-visible,.focus){
	outline: var(--border-width) solid var(--primary-border-focus); outline-offset: -1px; z-index: 2 }

.forms a:is(.btn, .btn:hover) { text-decoration: none }

/* ┌─────────────────╮
 * |Button Status    |
 * └─────────────────╯*/
/* TODO: Let inputs have status also. */
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])):is(.progress,.error,.complete) { position: relative }
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])):is(.progress,.error,.complete):after { position: relative;	margin-right: -16px; top: 1px; left: 1px; }
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])):is(.progress,.error,.complete).primary:after { filter: invert(100%) }
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])).progress:after {
	content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path style="transform-origin: center" fill="currentColor" d="M13 2v2c4.39.54 7.5 4.53 6.96 8.92A8.014 8.014 0 0 1 13 19.88v2c5.5-.6 9.45-5.54 8.85-11.03C21.33 6.19 17.66 2.5 13 2m-2 0c-1.96.18-3.81.95-5.33 2.2L7.1 5.74c1.12-.9 2.47-1.48 3.9-1.68V2M4.26 5.67A9.81 9.81 0 0 0 2.05 11h2c.19-1.42.75-2.77 1.64-3.9L4.26 5.67M2.06 13c.2 1.96.97 3.81 2.21 5.33l1.42-1.43A8.002 8.002 0 0 1 4.06 13h-2m5 5.37l-1.39 1.37A9.994 9.994 0 0 0 11 22v-2a8.002 8.002 0 0 1-3.9-1.63h-.04Z"><animateTransform attributeName="transform" type="rotate" from="0 0 0" to="360 0 0" dur="2s" repeatCount="indefinite" /></path></svg>');
}
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])).complete:after {
	content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M13 2.03v2.02c4.39.54 7.5 4.53 6.96 8.92c-.46 3.64-3.32 6.53-6.96 6.96v2c5.5-.55 9.5-5.43 8.95-10.93c-.45-4.75-4.22-8.5-8.95-8.97m-2 .03c-1.95.19-3.81.94-5.33 2.2L7.1 5.74c1.12-.9 2.47-1.48 3.9-1.68v-2M4.26 5.67A9.885 9.885 0 0 0 2.05 11h2c.19-1.42.75-2.77 1.64-3.9L4.26 5.67M15.5 8.5l-4.88 4.88l-2.12-2.12l-1.06 1.06l3.18 3.18l5.94-5.94L15.5 8.5M2.06 13c.2 1.96.97 3.81 2.21 5.33l1.42-1.43A8.002 8.002 0 0 1 4.06 13h-2m5.04 5.37l-1.43 1.37A9.994 9.994 0 0 0 11 22v-2a8.002 8.002 0 0 1-3.9-1.63Z"/></svg>');
}
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])).error:after {
	content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M13 2v2c4.39.54 7.5 4.53 6.96 8.92A8.014 8.014 0 0 1 13 19.88v2c5.5-.6 9.45-5.54 8.85-11.03C21.33 6.19 17.66 2.5 13 2m-2 0c-1.96.18-3.81.95-5.33 2.2L7.1 5.74c1.12-.9 2.47-1.48 3.9-1.68v-2M4.26 5.67A9.81 9.81 0 0 0 2.05 11h2c.19-1.42.75-2.77 1.64-3.9L4.26 5.67M2.06 13c.2 1.96.97 3.81 2.21 5.33l1.42-1.43A8.002 8.002 0 0 1 4.06 13h-2m5 5.37l-1.39 1.37A9.994 9.994 0 0 0 11 22v-2a8.002 8.002 0 0 1-3.9-1.63h-.04M13 13V7h-2v6h2m0 4v-2h-2v2h2Z"/></svg>');
}

/* ┌─────────────────╮
 * |Button+Input Sizes
 * └─────────────────╯*/

/* Small buttons + inputs. */
/* We calculate how much vertical padding space is left after using line height and border: */
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])).small {
	min-height: var(--input-small); padding: calc((var(--input-small) - 1lh) / 2 - var(--border-width)) calc(var(--input-small) / 2)
}
.forms :is(
	input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit]),
	.input, select, textarea).small {
	min-height: var(--input-small); padding: calc((var(--input-small) - 1lh) / 2 - var(--border-width)) calc(var(--input-small) / 4);
}
.forms :is(button, .btn, input, select).small {
	height: var(--input-small); /* Needed for <select> to get it to shrink its height. */
}


/* Big buttons + inputs. */
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])).big:not(.sel-weight) {
	height: var(--input-big); padding: calc((var(--input-big) - 1lh) / 2 - var(--border-width)) calc(var(--input-big))
}
.forms :is(
	input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit]),
	.input, select, textarea).big {
	min-height: var(--input-big); padding: calc((var(--input-big) - 1lh) / 2 - var(--border-width)) calc(var(--input-big) / 3);
}


/* Huge buttons + inputs */
.forms :is(.btn, button, input:is([type=button],[type=submit],[type=reset])).huge:not(.sel-weight) {
	height: var(--input-huge); padding: calc((var(--input-huge) - 1lh) / 2 - var(--border-width)) calc(var(--input-huge))
}
.forms :is(
	input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit]),
	.input, select, textarea).huge {
	min-height: var(--input-huge); padding: calc((var(--input-huge) - 1lh) / 2 - var(--border-width)) calc(var(--input-huge) / 3);
}

/* ┌─────────────────╮
 * |Modifiers        |
 * └─────────────────╯*/
/* Grouped inputs + buttons share borders */
.forms .grouped > :is(:not(:first-child), .group-left),
.forms .grouped > :is(:not(:first-child), .group-left) :is(input, .input, select, textarea, button, .btn),
.forms .grouped > input[type=checkbox]:is(.normal,.big,.huge):is(:not(:first-child), .group-left):before,
.forms .grouped > :is(:not(:first-child), .group-left) input[type=checkbox]:is(.normal,.big,.huge):before {
	margin-left: -1px; border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important;
}
.forms .grouped > :is(:not(:last-child), .group-right),
.forms .grouped > :is(:not(:last-child), .group-right) :is(input, .input, select, textarea, button, .btn),
.forms .grouped > input[type=checkbox]:is(.normal,.big,.huge):is(:not(:last-child), .group-right):before,
.forms .grouped > :is(:not(:last-child), .group-right) input[type=checkbox]:is(.normal,.big,.huge):before {
	border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important;
}

/* Flat Buttons + Inputs have no bg, border, or padding.  Good for toolbars. */
.forms :is(input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range]),
	.input, select, textarea, button, .btn).flat {
	border: var(--border-width) solid transparent; background: transparent;
}
.forms :is(input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit]),
	.input, select, textarea, button, .btn).flat:is(:focus-visible,.focus) {
	outline: var(--border-focus)
}

.forms :is(button, .btn, [type=button],[type=reset],[type=submit]):not([disabled]).flat:is(.selected, :hover) {
	border: var(--border-width) solid var(--secondary-background-hover); background: var(--secondary-background-hover);
	color: var(--invert)
}

.forms .input:focus-within :focus-within { outline: none !important }

/* ┌─────────────────╮
 * |Checkboxes       |
 * └─────────────────╯*/
/* Allow us to customize the border on checkboxes when they're invalid. */
.forms [type=checkbox] { appearance:none; outline: none; content: none; margin: 0; vertical-align: text-top; }
.forms [type=checkbox]:before { content: "✓"; box-sizing: border-box; text-align: center; color: transparent; background: var(--input-background);
	display: table-cell; vertical-align: middle;
	width: .9rem; height: .9rem; font: bold .75rem Arial; line-height: 0;}
.forms [type=checkbox]:not(.flat,.square):before { border-radius: var(--border-radius) }
.forms [type=checkbox]:not(.flat):before { border: var(--border-width) solid var(--input-border) }
.forms [type=checkbox]:is(:focus-visible,.focus):before { outline: var(--border-focus); outline-offset: -1px; z-index: 2; position: relative } /* relative needed for z-index to work */

/* Checkbox gets primary style when checked. */
.forms [type=checkbox]:checked:before { color: white; background: var(--primary-background) }
.forms [type=checkbox]:not(.flat):checked:before { border: var(--border-width) solid var(--input-border) }
.forms [type=checkbox]:checked:is(:focus-visible,.focus):before { outline: var(--border-width) solid var(--primary-border-focus) }

/* Various sizes of checkboxes */
.forms [type=checkbox].small:before {
	width: var(--input-small);
	height: var(--input-small);
	font-size: calc(var(--input-small) * .75) }
.forms [type=checkbox].normal:before {
	width: var(--input-normal);
	height: var(--input-normal);
	font-size: calc(var(--input-normal) * .75) }
.forms [type=checkbox].big:before {
	width: var(--input-big);
	height: var(--input-big);
	font-size: calc(var(--input-big) * .75) }
.forms [type=checkbox].huge:before {
	width: var(--input-huge);
	height: var(--input-huge);
	font-size: calc(var(--input-huge) * .75) }

/* ┌─────────────────╮
 * |Data table       |
 * └─────────────────╯*/
.forms .data-table { border-collapse: collapse; background: var(--table-background) }
.forms .data-table :is(thead,.thead.tbody,.tbody,tfoot,.tfoot):first-of-type :is(th,.th,td,.td) { border-top: var(--border-width) solid var(--table-border) }
.forms .data-table :is(th,.th) { padding: 6px 10px; border-bottom: var(--border-width) solid var(--table-border); text-align: left; user-select: none;
	font-weight: 500; background: var(--table-header-background); white-space: nowrap }
.forms .data-table :is(thead,.thead) :is(th,.th) { vertical-align: bottom } /* column headers */
.forms .data-table :is(tbody,.tbody,tfoot,.tfoot) :is(th,.th) { vertical-align: top } /* row headers, footer */
.forms .data-table :is(td,.td) { padding: 6px 10px; border-bottom: var(--border-width) solid var(--table-border); vertical-align: top }
.forms .data-table :is(th,.th):first-of-type,
.forms .data-table :is(td,.td):first-of-type { border-left: var(--border-width) solid var(--table-border) }
.forms .data-table :is(th,.th),
.forms .data-table :is(td,.td) { border-right: var(--border-width) solid var(--table-border) }

/* ┌─────────────────╮
 * |Grid             |
 * └─────────────────╯*/
/* Rows and column layout.  These can occor on the same element with .forms
 * Unlike bootstrap, a col class will stack each of its children into a column,
 * and having a col class for each item in a row isn't necessary.*/
.forms .row { display: flex; align-items: start }  /* align-items: start prevents stretching to available height */
.forms .col { display: flex; flex-direction: column; align-items: start }

/* Gaps */
.forms .gap-micro { gap: var(--micro) }
.forms .gap-tiny { gap: var(--tiny) }
.forms .gap-small { gap: var(--small) }
.forms .gap { gap: var(--normal) }
.forms .gap-big { gap: var(--big) }
.forms .gap-huge { gap: var(--huge) }

/* Pad */
/* We need both :not(.sel-weight):not(.sel-weight2) to override input pad-left and pad-right above */
.forms :not(.sel-weight):not(.sel-weight2).pad-micro { padding: var(--micro) }
.forms :not(.sel-weight):not(.sel-weight2).pad-tiny { padding: var(--tiny) }
.forms :not(.sel-weight):not(.sel-weight2).pad-small { padding: var(--small) }
.forms :not(.sel-weight):not(.sel-weight2).pad { padding: var(--normal) }
.forms :not(.sel-weight):not(.sel-weight2).pad-big { padding: var(--big) }
.forms :not(.sel-weight):not(.sel-weight2).pad-huge { padding: var(--huge) }

/* TODO: Put these in mobile styles: */
.forms :not(.sel-weight):not(.sel-weight2).pad-h-tiny { padding-left: var(--tiny); padding-right: var(--tiny) }
.forms :not(.sel-weight):not(.sel-weight2).pad-h-small { padding-left: var(--small); padding-right: var(--small) }
.forms :not(.sel-weight):not(.sel-weight2).pad-h { padding-left: var(--normal); padding-right: var(--normal) }
.forms :not(.sel-weight):not(.sel-weight2).pad-h-big { padding-left: var(--big); padding-right: var(--big) }
.forms :not(.sel-weight):not(.sel-weight2).pad-h-huge { padding-left: var(--huge); padding-right: var(--huge) }

.forms :not(.sel-weight):not(.sel-weight2).pad-v-tiny { padding-top: var(--tiny); padding-bottom: var(--tiny) }
.forms :not(.sel-weight):not(.sel-weight2).pad-v-small { padding-top: var(--small); padding-bottom: var(--small) }
.forms :not(.sel-weight):not(.sel-weight2).pad-v { padding-top: var(--normal); padding-bottom: var(--normal) }
.forms :not(.sel-weight):not(.sel-weight2).pad-v-big { padding-top: var(--big); padding-bottom: var(--big) }
.forms :not(.sel-weight):not(.sel-weight2).pad-v-huge { padding-top: var(--huge); padding-bottom: var(--huge) }

/* Alignment */
.forms .row:is(.center, .center-h) { justify-content: center }
.forms .col:is(.center, .center-h) { align-items: center }

.forms .row:is(.center, .center-v) { align-items: center }
.forms .col:is(.center, .center-v) { justify-content: center }

.forms .row.left { justify-content: start }
.forms .col.left { align-items: start }

.forms .row.right { justify-content: end }
.forms .col.right { align-items: end }

.forms .row.top { align-items: start }
.forms .col.top { justify-content: start }

.forms .row.bottom { align-items: end }
.forms .col.bottom { justify-content: end }

.forms :is(.row,.col).stretch { align-items: stretch }
.forms :is(.row,.col).stretch > * { flex: 1 }

.forms .row.stretch-h > * { flex: 1 }
.forms .row.stretch-v { align-items: stretch }

.forms .col.stretch-h { align-items: stretch }
.forms .col.stretch-v  > * { flex: 1 }

/* Spacing */
.forms .space-between { justify-content: space-between }
.forms .space-around { justify-content: space-around }
.forms .space-evenly { justify-content: space-evenly }

/* Wrap */
.forms .wrap { flex-wrap: wrap }
.forms .nowrap { flex-wrap: nowrap; white-space: nowrap }

/* Labels */
.forms .label { font-size :85%; font-weight: bold; user-select: none }
.forms .side-label-tiny { min-width: 4rem; max-width: 4rem; user-select: none }
.forms .side-label-small { min-width: 6rem; max-width: 6rem; user-select: none }
.forms .side-label { min-width: 8rem; max-width: 8rem; user-select: none }
.forms .side-label-big { min-width: 10rem; max-width: 10rem; user-select: none }
.forms .side-label-huge { min-width: 14rem; max-width: 14rem; user-select: none }


/* A horizontal form row with the first column fixed-width for labels.
 * @deprecated for .side-label */
.forms .form-row { display: flex; flex-direction: row; align-items: start }
.forms .form-row > :first-child { flex: 0; width: 8rem }
.forms .form-row.wide > :first-child { flex: 0; min-width: 12rem }
.forms .form-row > :not(:first-child) { flex: 1 }

/* TODO make mobile versions of this.  What if we wantn to expand only on tablet? .no-expand-desktop */
.forms .expand { flex: 1 }


/* ┌─────────────────╮
 * |Alerts           |
 * └─────────────────╯*/
.forms .success { background: #cfd; color: #374; padding: var(--small) var(--normal); margin-top: var(--normal); margin-bottom: var(--normal) }
.forms .warning { background: #fec; color: #863; padding: var(--small) var(--normal); margin-top: var(--normal); margin-bottom: var(--normal) }


/* ┌─────────────────╮
 * |Grid Tablet+     |
 * └─────────────────╯*/
@media (min-width: 768px) {
	/**
	 * To have big padding on desktop, normal on tablet, and none on mobile, do:
	 * padding-left: var(--big-desktop, var(--normal-tablet))  */
	:root {
		--micro-tablet: var(--micro);
		--tiny-tablet: var(--tiny);
		--small-tablet: var(--small);
		--normal-tablet: var(--normal);
		--big-tablet: var(--big);
		--huge-tablet: var(--huge);
	}

	/* Row/Col */
	.forms .row-tablet { display: flex; flex-direction: row; align-items: start; justify-content: start }
	.forms .col-tablet { display: flex; flex-direction: column; align-items: start; justify-content: start }

	/* Gaps */
	.forms .gap-tiny-tablet { gap: var(--micro) }
	.forms .gap-small-tablet {  gap: var(--small) }
	.forms .gap-tablet {  gap: var(--normal) }
	.forms .gap-big-tablet {  gap: var(--big) }
	.forms .gap-huge-tablet {  gap: var(--huge) }

	/* Pad */
	.forms :not(.sel-weight):not(.sel-weight2).pad-tiny-tablet { padding: var(--micro) }
	.forms :not(.sel-weight):not(.sel-weight2).pad-small-tablet {  padding: var(--small) }
	.forms :not(.sel-weight):not(.sel-weight2).pad-tablet {  padding: var(--normal) }
	.forms :not(.sel-weight):not(.sel-weight2).pad-big-tablet {  padding: var(--big) }
	.forms :not(.sel-weight):not(.sel-weight2).pad-huge-tablet {  padding: var(--huge) }
	
	/* TODO: pad-h and pad-v */

	/* Alignment */
	.forms .row-tablet:is(.center-tablet, .center-h-tablet) { justify-content: center }
	.forms .col-tablet:is(.center-tablet, .center-h-tablet) { align-items: center }

	.forms .row-tablet:is(.center-tablet, .center-v-tablet) { align-items: center }
	.forms .col-tablet:is(.center-tablet, .center-v-tablet) { justify-content: center }

	.forms .row-tablet.left-tablet { justify-content: start }
	.forms .col-tablet.left-tablet { align-items: start }

	.forms .row-tablet.right-tablet { justify-content: end }
	.forms .col-tablet.right-tablet { align-items: end }

	.forms .row-tablet.top-tablet { align-items: start }
	.forms .col-tablet.top-tablet { justify-content: start }

	.forms .row-tablet.bottom-tablet { align-items: end }
	.forms .col-tablet.bottom-tablet { justify-content: end }

	.forms :is(.row-tablet,.col-tablet).stretch-tablet { align-items: stretch }
	.forms :is(.row-tablet,.col-tablet).stretch-tablet > * { flex: 1 }

	.forms .row-tablet.stretch-h-tablet > * { flex: 1 }
	.forms .row-tablet.stretch-v-tablet { align-items: stretch }

	.forms .col-tablet.stretch-h-tablet { align-items: stretch }
	.forms .col-tablet.stretch-v-tablet > * { flex: 1 }

	/* Spacing */
	/* We use .sel-weight so this can override .forms .col.center w/ a selector weight of 3 above. */
	.forms .space-between-tablet:not(.sel-weight) { justify-content: space-between }
	.forms .space-around-tablet:not(.sel-weight) { justify-content: space-around }
	.forms .space-evenly-tablet:not(.sel-weight) { justify-content: space-evenly }

	/* Wrap */
	.forms .wrap-tablet { flex-wrap: wrap }
	.forms .nowrap-tablet { flex-wrap: nowrap; white-space: nowrap }

	/* @deprecated for .side-label. A horizontal form row with the first column fixed-width for labels */
	.forms .form-row-tablet { display: flex; flex-direction: row; align-items: start }
	.forms .form-row-tablet > :first-child { flex: 0; min-width: 8rem }
	.forms .form-row-tablet.wide > :first-child { flex: 0; min-width: 12rem }
	.forms .form-row-tablet > :not(:first-child) { flex: 1 }
}

/* ┌─────────────────╮
 * |Grid Desktop+    |
 * └─────────────────╯*/
@media (min-width: 992px) {
	:root {
		--micro-desktop: var(--micro);
		--tiny-desktop: var(--tiny);
		--small-desktop: var(--small);
		--normal-desktop: var(--normal);
		--big-desktop: var(--big);
		--huge-desktop: var(--huge);
	}

	/* Row/Col */
	.forms .row-desktop { display: flex; flex-direction: row; align-items: start; justify-content: start }
	.forms .col-desktop { display: flex; flex-direction: column; align-items: start; justify-content: start }

	/* Gaps */
	.forms .gap-tiny-desktop { gap: var(--micro) }
	.forms .gap-small-desktop {  gap: var(--small) }
	.forms .gap-desktop {  gap: var(--normal) }
	.forms .gap-big-desktop {  gap: var(--big) }
	.forms .gap-huge-desktop {  gap: var(--huge) }

	/* Pad */
	.forms :not(.sel-weight):not(.sel-weight2).pad-tiny-desktop { padding: var(--micro) }
	.forms :not(.sel-weight):not(.sel-weight2).pad-small-desktop {  padding: var(--small) }
	.forms :not(.sel-weight):not(.sel-weight2).pad-desktop {  padding: var(--normal) }
	.forms :not(.sel-weight):not(.sel-weight2).pad-big-desktop {  padding: var(--big) }
	.forms :not(.sel-weight):not(.sel-weight2).pad-huge-desktop {  padding: var(--huge) }
	
	/* TODO: pad-h and pad-v */

	/* Alignment */
	.forms .row-desktop:is(.center-desktop, .center-h-desktop) { justify-content: center }
	.forms .col-desktop:is(.center-desktop, .center-h-desktop) { align-items: center }

	.forms .row-desktop:is(.center-desktop, .center-v-desktop) { align-items: center }
	.forms .col-desktop:is(.center-desktop, .center-v-desktop) { justify-content: center }

	.forms .row-desktop.left-desktop { justify-content: start }
	.forms .col-desktop.left-desktop { align-items: start }

	.forms .row-desktop.right-desktop { justify-content: end }
	.forms .col-desktop.right-desktop { align-items: end }

	.forms .row-desktop.top-desktop { align-items: start }
	.forms .col-desktop.top-desktop { justify-content: start }

	.forms .row-desktop.bottom-desktop { align-items: end }
	.forms .col-desktop.bottom-desktop { justify-content: end }

	.forms :is(.row-desktop,.col-desktop).stretch-desktop { align-items: stretch }
	.forms :is(.row-desktop,.col-desktop).stretch-desktop > * { flex: 1 }

	.forms .row-desktop.stretch-h-desktop > * { flex: 1 }
	.forms .row-desktop.stretch-v-desktop { align-items: stretch }

	.forms .col-desktop.stretch-h-desktop { align-items: stretch }
	.forms .col-desktop.stretch-v-desktop > * { flex: 1 }

	/* Spacing */
	/* We use .sel-weight so this can override .forms .col.center w/ a selector weight of 3 above. */
	.forms .space-between-desktop:not(.sel-weight) { justify-content: space-between }
	.forms .space-around-desktop:not(.sel-weight) { justify-content: space-around }
	.forms .space-evenly-desktop:not(.sel-weight) { justify-content: space-evenly }

	/* Wrap */
	.forms .wrap-desktop { flex-wrap: wrap }
	.forms .nowrap-desktop { flex-wrap: nowrap; white-space: nowrap }

	/* @deprecated for .side-label. A horizontal form row with the first column fixed-width for labels */
	.forms .form-row-desktop { display: flex; flex-direction: row; align-items: start }
	.forms .form-row-desktop > :first-child { flex: 0; min-width: 8rem }
	.forms .form-row-desktop.wide > :first-child { flex: 0; min-width: 12rem }
	.forms .form-row-desktop > :not(:first-child) { flex: 1 }
}

/* ┌─────────────────╮
 * |Grid Misc        |
 * └─────────────────╯*/
.forms .col hr { width: 100% }


/* ┌─────────────────╮
 * |Experimental     |
 * └─────────────────╯*/
/* These may change in the future. */

/* drop-menu */
/* A menu with expandable sub-items. */
.forms .drop-menu ul { list-style: none; margin: 0; padding: 0 }
.forms .drop-menu ul a { display: block }
.forms .drop-menu ul li { position: relative }
.forms .drop-menu ul ul { visibility: hidden; position: absolute; top: 100%; left: 0; z-index: 1 }
.forms .drop-menu ul:not(:hover) ul { transition: visibility 0s; transition-delay: .6s }
.forms .drop-menu ul:hover > ul:not(:hover) { transition: visibility 0s; transition-delay: 0s; display: none }
.forms .drop-menu ul ul ul { top: 0; left: 100% }
.forms .drop-menu ul li:hover > ul { visibility: visible; transition-delay: 0s }



/* ┌─────────────────╮
 * |Deprecated       |
 * └─────────────────╯*/
/* These are deprecated, use pad-h and pad-v */
.forms .pad-tiny-small, .forms.pad-tiny-small { padding: var(--tiny) var(--small) }
.forms .pad-small-normal, .forms.pad-small-normal { padding: var(--small) var(--normal) }

