/* MMB visual schedule builder — [mmb_schedule_builder]
   BEM on ACSS tokens. The sheet (#vsb-sheet) is the printable artefact. */

.vsb {
	--vsb-line: var(--neutral-light);
	display: grid;
	gap: var(--space-m);
}

/* Toolbar */
.vsb__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-xs);
}

.vsb__modes {
	display: inline-flex;
	border: 1px solid var(--vsb-line);
	border-radius: var(--radius-m);
	overflow: hidden;
}

.vsb__mode {
	appearance: none;
	border: 0;
	background: var(--card-bg-color);
	color: var(--text-dark);
	font: inherit;
	font-size: var(--text-s);
	padding: var(--space-xs) var(--space-s);
	min-height: 44px;
	cursor: pointer;
}

.vsb__mode[aria-pressed="true"] {
	background: var(--primary-hover);
	color: var(--white);
	font-weight: 700;
}

.vsb__print {
	margin-inline-start: auto;
	appearance: none;
	border: 0;
	border-radius: var(--radius-m);
	background: var(--primary-hover);
	color: var(--white);
	font: inherit;
	font-size: var(--text-s);
	font-weight: 700;
	padding: var(--space-xs) var(--space-s);
	min-height: 44px;
	cursor: pointer;
}

.vsb__print:hover { background: var(--primary-dark); }

.vsb__clear {
	appearance: none;
	border: 0;
	background: none;
	color: var(--text-dark-muted);
	font: inherit;
	font-size: var(--text-xs);
	text-decoration: underline;
	cursor: pointer;
}

/* Sheet */
.vsb__sheet {
	background: var(--white);
	border: 1px solid var(--vsb-line);
	border-radius: var(--radius-l);
	padding: var(--space-m);
	display: grid;
	gap: var(--space-m);
}

.vsb__sheet-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--space-xs);
	border-bottom: 2px solid var(--primary);
	padding-bottom: var(--space-xs);
}

.vsb__title {
	font-family: var(--heading-font-family);
	font-size: var(--text-l);
	font-weight: 700;
	color: var(--text-dark);
	border: 0;
	background: transparent;
	min-width: 8ch;
	flex: 1 1 12ch;
}

.vsb__name {
	font: inherit;
	font-size: var(--text-s);
	color: var(--text-dark-muted);
	border: 0;
	border-bottom: 1px dashed var(--vsb-line);
	background: transparent;
	min-width: 10ch;
}

.vsb__title:focus-visible,
.vsb__name:focus-visible { outline: 2px solid var(--primary); border-radius: var(--radius-s); }

/* Sections */
.vsb-section { display: grid; gap: var(--space-xs); }

.vsb-section__head {
	display: flex;
	align-items: center;
	gap: var(--space-2xs);
	color: var(--primary-dark);
	font-weight: 700;
	font-size: var(--text-s);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.vsb-section__head svg { width: 1.25em; height: 1.25em; }

.vsb-section__slots {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
	gap: var(--space-xs);
}

.vsb--firstthen .vsb-section__slots { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }

.vsb-section__add {
	appearance: none;
	border: 0;
	background: none;
	color: var(--text-dark-muted);
	font: inherit;
	font-size: var(--text-xs);
	text-align: start;
	cursor: pointer;
	justify-self: start;
	text-decoration: underline;
}

/* Slots */
.vsb-slot {
	position: relative;
	display: grid;
	justify-items: center;
	gap: var(--space-2xs);
	border: 2px dashed var(--vsb-line);
	border-radius: var(--radius-m);
	padding: var(--space-xs);
	min-height: 7rem;
	cursor: pointer;
}

.vsb-slot--filled { border-style: solid; border-color: var(--primary); background: var(--secondary-ultra-light); }

.vsb-slot--active { outline: 3px solid var(--accent); outline-offset: 2px; }

.vsb-slot--over { border-color: var(--accent-hover); background: var(--neutral-ultra-light); }

.vsb-slot__plus {
	align-self: center;
	color: var(--text-dark-muted);
	font-size: var(--text-l);
	line-height: 1;
}

.vsb-slot__hint { color: var(--text-dark-muted); font-size: var(--text-xs); align-self: end; text-align: center; }

.vsb-slot__icon { width: 3rem; height: 3rem; color: var(--primary-dark); }
.vsb-slot__icon svg { width: 100%; height: 100%; }

.vsb-slot__label {
	font: inherit;
	font-size: var(--text-xs);
	font-weight: 700;
	color: var(--text-dark);
	text-align: center;
	border: 0;
	background: transparent;
	width: 100%;
}

.vsb-slot__time {
	font: inherit;
	font-size: var(--text-xs);
	color: var(--text-dark-muted);
	text-align: center;
	border: 0;
	border-top: 1px dashed var(--vsb-line);
	background: transparent;
	width: 100%;
}

.vsb-slot__label:focus-visible,
.vsb-slot__time:focus-visible { outline: 2px solid var(--primary); border-radius: var(--radius-s); }

.vsb-slot__remove {
	position: absolute;
	top: -0.6rem;
	right: -0.6rem;
	appearance: none;
	border: 0;
	border-radius: 50%;
	width: 1.5rem;
	height: 1.5rem;
	line-height: 1;
	background: var(--text-dark);
	color: var(--white);
	font-size: var(--text-xs);
	cursor: pointer;
}

/* Library */
.vsb__library { display: grid; gap: var(--space-xs); }

.vsb__library-title { font-weight: 700; font-size: var(--text-s); color: var(--text-dark); }

.vsb__icons {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr));
	gap: var(--space-2xs);
}

.vsb-icon {
	appearance: none;
	display: grid;
	justify-items: center;
	gap: 0.25rem;
	border: 1px solid var(--vsb-line);
	border-radius: var(--radius-m);
	background: var(--card-bg-color);
	color: var(--text-dark);
	font: inherit;
	font-size: var(--text-xs);
	padding: var(--space-2xs);
	cursor: grab;
}

.vsb-icon:hover { border-color: var(--primary); }

.vsb-icon[aria-pressed="true"] { border-color: var(--accent-hover); outline: 2px solid var(--accent-hover); }

.vsb-icon svg { width: 2.25rem; height: 2.25rem; color: var(--primary-dark); }

.vsb__hint { color: var(--text-dark-muted); font-size: var(--text-xs); margin: 0; }

/* Print: show only the sheet */
@media print {
	body * { visibility: hidden; }
	#vsb-sheet, #vsb-sheet * { visibility: visible; }
	#vsb-sheet {
		position: absolute;
		inset: 0 auto auto 0;
		width: 100%;
		border: 0;
		border-radius: 0;
		padding: 0;
	}
	.vsb-slot { border-width: 2px; min-height: 8rem; }
	.vsb-slot--empty, .vsb-slot__remove, .vsb-section__add { display: none !important; }
	.vsb-slot--active { outline: none; }
	.vsb__title, .vsb__name, .vsb-slot__label, .vsb-slot__time { border: 0; }
}
