/* 3task Toolbar: dialogs in the admin (elements, emoji, table style) and the toolbar builder. */
.threece-dialog {
	border: 0;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	max-width: min(1100px, calc(100vw - 32px));
	padding: 0;
	width: 100%;
}

.threece-dialog::backdrop {
	background: rgba(0, 0, 0, 0.5);
}

.threece-dialog__head,
.threece-dialog__foot {
	align-items: center;
	border-bottom: 1px solid #dcdcde;
	display: flex;
	gap: 8px;
	justify-content: space-between;
	padding: 12px 16px;
}

.threece-dialog__foot {
	border-bottom: 0;
	border-top: 1px solid #dcdcde;
	justify-content: flex-end;
}

.threece-dialog__head h1 {
	font-size: 18px;
	margin: 0;
}

.threece-close {
	background: none;
	border: 0;
	cursor: pointer;
	font-size: 24px;
	line-height: 1;
}

/* Element dialog, design "Block inserter": list (search, groups, cards) and form (fields, preview, shortcode). */
.threece-inserter {
	--threece-ui: var(--wp-admin-theme-color, #2271b1);
	--threece-ui-line: #dcdcde;
	--threece-ui-mute: #646970;
	display: none;
	grid-template-rows: auto minmax(0, 1fr) auto;
	height: min(660px, calc(100vh - 64px));
	max-width: none;
	overflow: hidden;
	width: min(1000px, calc(100vw - 48px));
}

.threece-inserter[open] {
	display: grid;
}

.threece-inserter .threece-dialog__head h1 {
	font-size: 15px;
	white-space: nowrap;
}

.threece-inserter__search {
	align-items: center;
	background: #f0f0f1;
	border-radius: 4px;
	color: var(--threece-ui-mute);
	display: flex;
	flex: 1;
	gap: 8px;
	padding: 0 10px;
}

.threece-inserter__search[hidden] {
	display: flex;
	visibility: hidden;
}

.threece-inserter__search input[type="search"] {
	background: none;
	border: 0;
	box-shadow: none;
	flex: 1;
	font-size: 14px;
	min-height: 36px;
	min-width: 0;
}

.threece-inserter__search:focus-within {
	box-shadow: 0 0 0 2px var(--threece-ui);
}

.threece-inserter__search input[type="search"]:focus {
	box-shadow: none;
	outline: 0;
}

.threece-icon {
	display: inline-flex;
	flex: none;
	line-height: 0;
}

.threece-close {
	border-radius: 4px;
	color: inherit;
	height: 36px;
	justify-content: center;
	width: 36px;
}

.threece-close:hover {
	background: #f0f0f1;
}

/* List view */
.threece-listview {
	display: grid;
	grid-template-columns: 210px minmax(0, 1fr);
	min-height: 0;
}

.threece-listview[hidden],
.threece-formview[hidden] {
	display: none;
}

.threece-rail {
	border-inline-end: 1px solid var(--threece-ui-line);
	display: flex;
	flex-direction: column;
	gap: 2px;
	overflow: auto;
	padding: 10px 8px;
}

.threece-rail button {
	align-items: center;
	background: none;
	border: 0;
	border-radius: 4px;
	color: #1d2327;
	cursor: pointer;
	display: flex;
	font-size: 13px;
	gap: 9px;
	padding: 8px 10px;
	text-align: start;
}

.threece-rail button .threece-icon {
	color: var(--threece-ui-mute);
}

.threece-rail button:hover {
	background: #f6f7f7;
}

.threece-rail button[aria-current="true"] {
	background: color-mix(in srgb, var(--threece-ui) 10%, #fff);
	color: var(--threece-ui);
	font-weight: 600;
}

.threece-rail button[aria-current="true"] .threece-icon {
	color: var(--threece-ui);
}

.threece-rail__count {
	color: var(--threece-ui-mute);
	font-size: 11px;
	font-weight: 400;
	margin-inline-start: auto;
}

.threece-elcards {
	overflow: auto;
	padding: 4px 18px 18px;
}

.threece-section h3 {
	color: var(--threece-ui-mute);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.06em;
	margin: 14px 0 8px;
	text-transform: uppercase;
}

.threece-grid {
	display: grid;
	gap: 10px;
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.threece-elcard {
	background: #fff;
	border: 1px solid var(--threece-ui-line);
	border-radius: 6px;
	color: #1d2327;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	padding: 0;
	text-align: start;
}

.threece-elcard:hover,
.threece-elcard:focus-visible {
	border-color: var(--threece-ui);
	box-shadow: 0 0 0 1px var(--threece-ui);
	outline: 0;
}

.threece-elcard__name {
	align-items: center;
	display: flex;
	font-size: 13px;
	font-weight: 600;
	gap: 7px;
	padding: 8px 10px 2px;
}

.threece-elcard__name .threece-icon {
	color: var(--threece-ui);
}

.threece-elcard__desc {
	color: var(--threece-ui-mute);
	font-size: 12px;
	line-height: 1.35;
	padding: 0 10px 9px;
}

.threece-others {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.threece-other {
	background: #f0f0f1;
	border: 1px solid transparent;
	border-radius: 3px;
	cursor: pointer;
	font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace;
	padding: 5px 8px;
}

.threece-other:hover,
.threece-other:focus-visible {
	border-color: var(--threece-ui);
	outline: 0;
}

.threece-empty {
	color: var(--threece-ui-mute);
	margin: 24px 0;
}

/* Small drawings on the cards (decorative, aria-hidden) */
.threece-mp {
	--l: #d5d8de;
	--t: #2b2f36;
	--a: var(--threece-ui);
	background: #f6f7f7;
	border-bottom: 1px solid var(--threece-ui-line);
	border-radius: 5px 5px 0 0;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 5px;
	height: 84px;
	justify-content: center;
	overflow: hidden;
	padding: 10px 12px;
	position: relative;
}

.threece-mp .ln {
	background: var(--l);
	border-radius: 3px;
	display: block;
	height: 5px;
}

.threece-mp .w9 { width: 90%; }
.threece-mp .w7 { width: 70%; }
.threece-mp .w5 { width: 50%; }

.threece-mp--tabs .row { display: flex; gap: 4px; margin-bottom: 3px; }
.threece-mp--tabs .row .b { background: var(--l); border-radius: 4px 4px 0 0; height: 13px; width: 30%; }
.threece-mp--tabs .row .b:first-child { background: var(--a); }
.threece-mp--tabs .pane { border-top: 2px solid var(--a); display: flex; flex-direction: column; gap: 5px; padding-top: 6px; }
.threece-mp--accordion .bar { border: 1.5px solid var(--l); border-radius: 3px; display: block; height: 13px; }
.threece-mp--accordion .bar.open { border-color: var(--a); }
.threece-mp--accordion .body { display: flex; flex-direction: column; gap: 4px; padding: 2px 6px; }
.threece-mp--spoiler .bar { background: var(--l); border-radius: 3px; height: 14px; width: 62%; }
.threece-mp--spoiler .blur { display: flex; filter: blur(2.5px); flex-direction: column; gap: 5px; }
.threece-mp--columns { align-items: stretch; flex-direction: row; gap: 8px; }
.threece-mp--columns .c { display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.threece-mp--columns .c2 { flex: 2; }
.threece-mp--columns .c1 { border-inline-start: 3px solid var(--a); flex: 1; padding-inline-start: 6px; }
.threece-mp--notice .note { background: color-mix(in srgb, var(--a) 12%, #fff); border-inline-start: 3px solid var(--a); border-radius: 3px; display: flex; flex-direction: column; gap: 5px; padding: 9px 10px; }
.threece-mp--button { align-items: center; flex-direction: row; gap: 6px; justify-content: center; }
.threece-mp--button .b { background: var(--a); border-radius: 5px; height: 20px; width: 42%; }
.threece-mp--button .b + .b { background: transparent; border: 1.5px solid var(--a); }
.threece-mp--tooltip .bub { background: var(--t); border-radius: 4px; height: 16px; inset-inline-start: 12px; position: absolute; top: 8px; width: 58%; }
.threece-mp--tooltip .word { align-self: flex-start; border-bottom: 1.5px dotted var(--a); height: 8px; margin-top: 22px; width: 34%; }
.threece-mp--fn .t { align-items: flex-start; display: flex; gap: 2px; }
.threece-mp--fn .sup { background: var(--a); border-radius: 50%; height: 5px; width: 5px; }
.threece-mp--fn .foot { align-items: center; border-top: 1px solid var(--l); display: flex; gap: 4px; margin-top: 4px; padding-top: 4px; }
.threece-mp--fn .foot .i,
.threece-mp--toc .it .i { background: var(--a); border-radius: 1px; flex: none; height: 5px; width: 6px; }
.threece-mp--toc .it { align-items: center; display: flex; gap: 5px; }
.threece-mp--toc .sub { padding-inline-start: 12px; }
.threece-mp--video { align-items: center; background: #22262c; border-radius: 4px; margin: 6px 10px; height: calc(100% - 12px); }
.threece-mp--video .pl { background: #fff; border-radius: 50%; height: 22px; position: relative; width: 22px; }
.threece-mp--video .pl::after { border-bottom: 5px solid transparent; border-inline-start: 7px solid #22262c; border-top: 5px solid transparent; content: ""; inset-inline-start: 9px; position: absolute; top: 6px; }
.threece-mp--qr { align-items: center; }
.threece-mp--qr .q { background: #fff; display: grid; grid-template-columns: repeat(11, 4px); padding: 4px; }
.threece-mp--qr .q span { height: 4px; width: 4px; }
.threece-mp--qr .q .k { background: var(--t); }
.threece-mp--countdown { align-items: center; flex-direction: row; gap: 5px; justify-content: center; }
.threece-mp--countdown .u { background: color-mix(in srgb, var(--a) 16%, #fff); border-radius: 3px; height: 24px; width: 22px; }

/* Form view */
.threece-formview {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
	min-height: 0;
}

.threece-formcol {
	border-inline-end: 1px solid var(--threece-ui-line);
	overflow: auto;
	padding: 16px 18px;
}

.threece-back {
	align-items: center;
	background: none;
	border: 0;
	color: var(--threece-ui);
	cursor: pointer;
	display: inline-flex;
	gap: 6px;
	margin-bottom: 10px;
	padding: 0;
}

[dir="rtl"] .threece-back .threece-icon {
	transform: scaleX(-1);
}

.threece-formhead {
	align-items: center;
	display: flex;
	gap: 10px;
	margin-bottom: 8px;
}

.threece-formhead > .threece-icon {
	align-items: center;
	background: color-mix(in srgb, var(--threece-ui) 10%, #fff);
	border-radius: 6px;
	color: var(--threece-ui);
	height: 34px;
	justify-content: center;
	width: 34px;
}

.threece-formhead h2 {
	font-size: 15px;
	margin: 0;
}

.threece-formhead small {
	color: var(--threece-ui-mute);
	display: block;
	font-size: 12px;
}

.threece-field {
	margin: 12px 0 0;
}

.threece-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
}

.threece-field--check label {
	display: inline;
	font-weight: 400;
	margin-inline-start: 4px;
}

.threece-field :where(input[type="text"], input[type="number"], select, textarea) {
	max-width: 100%;
}

.threece-field input[type="text"],
.threece-field textarea {
	width: 100%;
}

.threece-fieldlabel {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
}

.threece-imagepick {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 8px 12px;
}

.threece-imagepick [hidden] {
	display: none;
}

.threece-imagepick__thumb img {
	aspect-ratio: 16 / 9;
	border: 1px solid var(--threece-ui-line);
	border-radius: 4px;
	display: block;
	height: auto;
	object-fit: cover;
	width: 96px;
}

.threece-imagepick__name {
	flex: 1 1 8em;
	min-width: 0;
	overflow-wrap: anywhere;
}

.threece-help {
	color: var(--threece-ui-mute);
	display: block;
	font-size: 12px;
	margin-top: 4px;
}

.threece-child {
	border: 1px solid var(--threece-ui-line);
	border-radius: 4px;
	margin: 12px 0 10px;
	padding: 4px 12px 10px;
}

.threece-previewcol {
	background: #f6f7f7;
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-height: 0;
	overflow: auto;
	padding: 16px 18px;
}

.threece-previewcol__label {
	color: var(--threece-ui-mute);
	display: flex;
	font-size: 11px;
	font-weight: 600;
	justify-content: space-between;
	letter-spacing: 0.04em;
	margin: 0;
	text-transform: uppercase;
}

.threece-preview {
	background: #fff;
	border: 0;
	border-radius: 6px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
	flex: 1;
	min-height: 220px;
	width: 100%;
}

.threece-code {
	background: #1d2327;
	border-radius: 4px;
	color: #f0f0f1;
	display: block;
	font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace;
	padding: 9px 11px;
	word-break: break-all;
}

.threece-inserter .threece-dialog__foot {
	gap: 10px;
}

.threece-keys {
	color: var(--threece-ui-mute);
	font-size: 12px;
	margin-inline-end: auto;
}

/* Phones and narrow windows: the dialog fills the screen, groups become a row that scrolls sideways. */
@media (max-width: 782px) {
	.threece-inserter {
		border-radius: 0;
		height: 100vh;
		height: 100dvh;
		max-height: none;
		width: 100vw;
	}

	.threece-inserter .threece-dialog__head {
		flex-wrap: wrap;
	}

	.threece-inserter .threece-dialog__head h1 {
		flex: 1;
	}

	.threece-inserter__search {
		flex-basis: 100%;
		order: 3;
	}

	.threece-inserter__search[hidden] {
		display: none;
	}

	.threece-listview {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto minmax(0, 1fr);
	}

	.threece-rail {
		border-bottom: 1px solid var(--threece-ui-line);
		border-inline-end: 0;
		flex-direction: row;
		overflow-x: auto;
		padding: 8px 10px;
	}

	.threece-rail button {
		border: 1px solid var(--threece-ui-line);
		border-radius: 16px;
		flex: none;
		padding: 5px 11px;
		white-space: nowrap;
	}

	.threece-rail__count {
		display: none;
	}

	.threece-elcards {
		padding: 4px 12px 12px;
	}

	.threece-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.threece-elcard__desc,
	.threece-keys {
		display: none;
	}

	.threece-formview {
		grid-template-columns: minmax(0, 1fr);
		overflow: auto;
	}

	.threece-formcol {
		border-inline-end: 0;
		overflow: visible;
	}

	.threece-previewcol {
		overflow: visible;
	}
}

/* Emoji dialog */
.threece-emoji {
	width: min(560px, calc(100vw - 32px));
}

.threece-emoji__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: min(520px, calc(100vh - 160px));
	padding: 12px 16px 16px;
}

.threece-emoji__search {
	width: 100%;
}

.threece-emoji__list {
	overflow-y: auto;
}

.threece-emoji__heading {
	color: #50575e;
	font-size: 12px;
	font-weight: 600;
	margin: 12px 0 4px;
}

.threece-emoji__grid {
	display: grid;
	gap: 2px;
	grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
}

.threece-emoji__item {
	background: transparent;
	border: 0;
	border-radius: 4px;
	cursor: pointer;
	font-size: 24px;
	height: 40px;
	line-height: 40px;
	padding: 0;
}

.threece-emoji__item:hover,
.threece-emoji__item:focus-visible {
	background: #f0f0f1;
	outline: 2px solid var(--threece-ui, #2271b1);
	outline-offset: -2px;
}

.threece-emoji__none {
	color: #50575e;
	margin: 16px 0;
}

/* Table style dialog */
.threece-ts {
	width: min(980px, calc(100vw - 32px));
}

.threece-ts-body {
	max-height: min(640px, calc(100vh - 160px));
	overflow-y: auto;
	padding: 12px 16px 16px;
}

.threece-ts-columns {
	display: grid;
	gap: 16px;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

@media (max-width: 782px) {
	.threece-ts-columns {
		grid-template-columns: 1fr;
	}
}

.threece-ts-group {
	border: 0;
	margin: 0 0 12px;
	padding: 0;
}

.threece-ts-group legend {
	font-weight: 600;
	margin-bottom: 6px;
}

.threece-ts-group--preset {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.threece-ts-group--preset legend {
	grid-column: 1 / -1;
}

.threece-ts-tile {
	border: 2px solid #dcdcde;
	border-radius: 6px;
	cursor: pointer;
	display: block;
	padding: 6px;
}


/* The chosen tile: a class set by table-dialog.js, so browsers without :has() show the choice too. */
.threece-ts-tile.is-checked {
	border-color: var(--threece-ui, #2271b1);
	box-shadow: 0 0 0 1px var(--threece-ui, #2271b1);
}

.threece-ts-tile.is-focus {
	outline: 2px solid var(--threece-ui, #2271b1);
	outline-offset: 2px;
}

.threece-ts-tile table {
	font-size: 10px;
	pointer-events: none;
	width: 100%;
}

.threece-ts-tile :where(th, td) {
	padding: 2px 4px;
}

.threece-ts-name {
	align-items: center;
	display: flex;
	font-weight: 600;
	gap: 6px;
	justify-content: center;
	margin-top: 6px;
}

.threece-ts-name input {
	margin: 0;
}

.threece-ts-preview {
	border: 1px solid #dcdcde;
	border-radius: 6px;
	margin-bottom: 12px;
	padding: 8px;
}

.threece-ts-preview table {
	font-size: 13px;
	width: 100%;
}

.threece-ts-check {
	display: inline-block;
	margin: 0 12px 4px 0;
}

.threece-ts-group--accent label {
	align-items: center;
	display: inline-flex;
	gap: 4px;
	margin: 0 10px 6px 0;
}

.threece-ts-dot {
	background: var(--threece-accent, #2271b1);
	border-radius: 50%;
	display: inline-block;
	height: 14px;
	width: 14px;
}

.threece-table--accent-theme .threece-ts-dot {
	background: conic-gradient(#1d4ed8, #15803d, #c2410c, #b91c1c, #1d4ed8);
}

.threece-ts-new {
	border-top: 1px solid #dcdcde;
	margin-top: 8px;
	padding-top: 8px;
}

.threece-ts-new summary {
	cursor: pointer;
	font-weight: 600;
}

.threece-ts-paste {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	margin: 6px 0;
	width: 100%;
}

/* WordPress buttons set display, which would beat the hidden attribute. */
.threece-inserter .threece-insert-now[hidden] {
	display: none;
}
